3v4l.org

run code in 300+ PHP versions simultaneously
<?php $itinerary = array (array('portName'=>'Day At Sea'), array('portName'=>'Moscow')); $badPorts = array('At Sea', 'Day At Sea', 'Cruising The Mediterranean Sea'); $image = ''; $image .= implode(',', array_reduce($itinerary, function ($result, $item){ if(!in_array($item['portName'], $badPorts)) $result[] = $item['portName']; //$index++; return $result; }, array())); var_dump($image);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $badPorts in /in/o6Z2K on line 6 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/o6Z2K:6 Stack trace: #0 /in/o6Z2K(6): in_array('Day At Sea', NULL) #1 [internal function]: {closure}(Array, Array) #2 /in/o6Z2K(5): array_reduce(Array, Object(Closure), Array) #3 {main} thrown in /in/o6Z2K on line 6
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
50.72 ms | 402 KiB | 8 Q