3v4l.org

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