3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dirToArray($dir) { $result = array(); $cdir = scandir($dir); foreach ($cdir as $key => $value) { if (!in_array($value,array(".",".."))) { if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) { $result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value); } else { $result[] = $value; } } } return $result; } print_r(dirToArray('/'));
Output for git.master_jit, git.master, rfc.property-hooks
Warning: scandir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/V9R4Q on line 6 Warning: scandir(/): Failed to open directory: Operation not permitted in /in/V9R4Q on line 6 Warning: scandir(): (errno 1): Operation not permitted in /in/V9R4Q on line 6 Warning: foreach() argument must be of type array|object, false given in /in/V9R4Q on line 7 Array ( )

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.86 ms | 402 KiB | 8 Q