3v4l.org

run code in 300+ PHP versions simultaneously
<?php $links = array( null => array(1, 2, 3, 4, 5), 2 => array(6, 7, 8, 9), 3 => array(10, 11), 10 => array(12), 12 => array(13) ); $nodes = array( 1 => array( "title" => 1, ), 2 => array( "title" => 2, ), 3 => array( "title" => 3, ), 4 => array( "title" => 4, ), 5 => array( "title" => 5, ), 6 => array( "title" => 6, ), 7 => array( "title" => 7, ), 8 => array( "title" => 8, ), 9 => array( "title" => 9, ), 10 => array( "title" => 10, ), 11 => array( "title" => 11, ), 12 => array( "title" => 12, ), 13 => array( "title" => 13, ), ); function f($node, $nodes, $links) { if (!isset($nodes[$node]["children"])) { $nodes[$node]["children"] = array(); } if (isset($links[$node])) { foreach($links[$node] as $child) { array_push($nodes[$node]["children"], f($child)); } } return $nodes[$node]; } f(null); print_r($nodes[null]["children"]);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: Too few arguments to function f(), 1 passed in /in/M0skj on line 68 and exactly 3 expected in /in/M0skj:53 Stack trace: #0 /in/M0skj(68): f(NULL) #1 {main} thrown in /in/M0skj on line 53
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:
46.08 ms | 401 KiB | 8 Q