3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function makeTableFromArray($array){ $tbl = "<table>"; $i = count($array); while($i--){ $tbl .= "<tr>"; $row = $array[$i]; $n = count($row); while($n--){ $tbl .= "<td>".$row[$n]."</td>"; } $tbl .= "</tr>"; } $tbl .= "</table>"; } $data = array ( 1 => array ( '01:00' => '1', '02:00' => '', ), 2 => array ( '01:00' => '3', '02:00' => '', ), 3 => array ( '01:00' => '23', '02:00' => '', ), 4 => array ( '01:00' => '234', '02:00' => '', ), 5 => array ( '01:00' => '234', '02:00' => '', ), 6 => array ( '01:00' => '', '02:00' => '', ), 7 => array ( '01:00' => '', '02:00' => '', ), ); echo makeTableFromArray($data);
based on hf2I2
Output for 7.2.0
Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 9 Warning: count(): Parameter must be an array or an object that implements Countable in /in/vn0ip on line 10
Output for 5.3.18 - 7.1.10
Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 1 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 12 Notice: Undefined offset: 0 in /in/vn0ip on line 9