<?php

function print_random_messages()
{
	$count_selected_messages=3;
	$output="";

	$messages=array(
		"Text 1.",
		"Text 2.",
		"Text 3.",
		"Text 4.",
		"Text 5.",
		"Text 6.",
		"Text 7.",
		"Text 8.",
	);

	for($i=0;$i<$count_selected_messages;$i++)
	{
		// new random item
		$count_messages=count($messages);
		$index_selected=random_int(0, $count_messages-1);

		// added the new item
		$output.="<div>".$messages[$index_selected]."</div>\n";

		// to remove the select item from all messages
		unset($messages[$index_selected]);
		$messages=array_merge($messages);
	}

	return $output;
}

/* RENDER OUTPUT */

Header("Cache-Control: no-cache");

?>
<style>
div {
	padding-top: 0.3em;
	padding-bottom: 0.3em;
	margin-top: 0.3em;
	margin-bottom: 0.3em;
	border-top: solid black 1px;
	border-bottom: solid black 1px;
	background: #D7D7D7;
	text-align: center;
}
</style>

<?php
echo print_random_messages();