3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $include('config.php') //mysql connection file $result = mysql_query("SELECT daystime.*, Sprinkler_ID FROM daystime, scheduler WHERE daystime.id = scheduler.DaysTime_ID ORDER BY daystime.id, Sprinkler_ID") or trigger_error(mysql_error()); $data_array = array(); while($rs = mysql_fetch_assoc($result)) { $key=$rs['id']; $value=$rs['Sprinkler_ID']; $data_array[$key] = [$value]; } 'root2' => array(3,4,5)); $out = ''; $count = count($data_array); $iter = 0; foreach ($data_array as $key => $value) { $iter++; $out.= $key.'=>['; $count = count($value); foreach ($value as $val) { $out.=$val.','; } $out.= ']'; if ($iter < ($count-1)) { $out.=',<br />'; } } echo $out;
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected '$result' (T_VARIABLE) in /in/Askcb on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/Askcb on line 3
Process exited with code 255.