3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $itinerary = array (array('portName'=>'Day At Sea'), array('portName'=>'Moscow'), array('portName'=>'Jupiter')); $badPorts = array('At Sea', 'Day At Sea', 'Cruising The Mediterranean Sea'); $image = ''; $arr = array(); array_walk($itinerary, function($item, $index) use(&$image, $badPorts){ if(!in_array($item['portName'], $badPorts)) $arr[] = $index.":".$item['portName'].","; } $image .= implode(',', $arr); var_dump($image); $image2 = ''; $arr2 = array(); foreach($itinerary as $index => $item){ if(!in_array($item['portName'], $badPorts)) $arr2[] = $index.":".$item['portName'].","; } $image2 .= implode(',', $arr2); var_dump($image2);
Output for 5.4.0 - 5.4.13
Parse error: syntax error, unexpected '$image' (T_VARIABLE) in /in/h9U02 on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.23
Parse error: syntax error, unexpected T_VARIABLE in /in/h9U02 on line 10
Process exited with code 255.