3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_files($path){ $folder = opendir($path); while ($dat = readdir($folder)){ if ($dat != "." && $dat != ".." && (is_dir($path."/".$dat) || substr($dat,-3) == "jpg" || substr($dat,-3) == "gif" || substr($dat,-3) == "bmp" || substr($dat,-3) == "png")){ if (is_dir($path."/".$dat)){ $dirs[] = get_files($path."/".$dat); } else{ $files[] = $path."/".$dat; } } } for ($i=0; $i<sizeof($dirs); $i++){ $files2 = array_merge($files2,$dirs[$i]); } $array = array_merge($files,$files2); return $array; } $path = "../test"; // Pfad zum Startverzeichnis $amount = sizeof(get_files($path)); for ($i=0; $i < $amount; $i++){ $files = get_files($path); $size += filesize($files[$i]); }
Output for git.master, git.master_jit
Warning: opendir(): open_basedir restriction in effect. File(../test) is not within the allowed path(s): (/tmp:/in:/etc) in /in/6I3u5 on line 3 Warning: opendir(../test): Failed to open directory: Operation not permitted in /in/6I3u5 on line 3 Fatal error: Uncaught TypeError: readdir(): Argument #1 ($dir_handle) must be of type resource or null, bool given in /in/6I3u5:4 Stack trace: #0 /in/6I3u5(4): readdir(false) #1 /in/6I3u5(28): get_files('../test') #2 {main} thrown in /in/6I3u5 on line 4
Process exited with code 255.
Output for rfc.property-hooks
Warning: opendir(): open_basedir restriction in effect. File(../test) is not within the allowed path(s): (/tmp:/in:/etc) in /in/6I3u5 on line 3 Warning: opendir(../test): Failed to open directory: Operation not permitted in /in/6I3u5 on line 3 Fatal error: Uncaught TypeError: readdir(): Argument #1 ($dir_handle) must be of type resource or null, false given in /in/6I3u5:4 Stack trace: #0 /in/6I3u5(4): readdir(false) #1 /in/6I3u5(28): get_files('../test') #2 {main} thrown in /in/6I3u5 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:
54.53 ms | 401 KiB | 8 Q