<?php
$dir = './';
$files = scandir($dir, 1);
if ($files !== false){
$k = 0;
echo '<style>
table{
border:1px solid black;
}
body{
text-align:center;
}
</style>';
echo '<table><tr>';
for($i = 0; $i < count($files); $i++){
$rest = substr($files[$i], -1);
if($rest == "g" || $rest == "G"|| $rest == "p" || $rest == "P"){
echo '<td><img src="'. $files[$i] .'"/></td>';
$k++;
}
if($k > 5)
{break;}
}
echo '</table></tr></div>';
}else{
echo $files;
}
?>
echo 'He drank some juice made of ' . $juice . 's.';