3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tasks[] = array(id => 1, parent_id => 0, title => 'task 1'); $tasks[] = array(id => 2, parent_id => 1, title => 'sub task 1'); $tasks[] = array(id => 3, parent_id => 1, title => 'sub task 2'); $tasks[] = array(id => 4, parent_id => 2, title => 'sub sub task 1'); $tasks[] = array(id => 5, parent_id => 0, title => 'task 2'); $tasks[] = array(id => 6, parent_id => 5, title => 'sub task 3'); function treeview($array, $id = 0) { for ($i = 0; $i < count($array); $i++) { if($array[$i][parent_id]==$id) { echo $array[$i][id].' '.$array[$i][parent_id].' '.$array[$i][title].'<br />'; treeview($array, $array[$i]['id']); } } } treeview($tasks);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "id" in /in/DkdOA:4 Stack trace: #0 {main} thrown in /in/DkdOA on line 4
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:
45.7 ms | 401 KiB | 8 Q