<?php
$j=0;
for ($i=0; $i<2; $i++)
{
$hour = 9;
$correct = 13;
$a = $hour;
$a = ereg_replace("0([0-9]+)", "\1", $a);
$b = $correct;
while ($a <= $b)
{
$room108[$j] = $a++;
echo "\n";
$j++;
}
}
$c_arr = array_count_values($room108);
foreach ($c_arr as $key => $value)
{
print $key . ' occured ' . $value . ' times<br>';
}
?>
The ouput for the above code is
9 occured 2 times
10 occured 2 times
11 occured 2 times
12 occured 2 times
13 occured 2 times
My question is How to arrange the output like this
RoomNo 108
8 --
9 2
10 2
11 2
12 2
13 2