3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP //directory to list, you choose; here we’ll just use the webroot $path = 'home/'; //warning: `is_dir` will need you to change to the parent directory of what you are testing //see <uk3.php.net/manual/en/function.is-dir.php#70005> for details chdir ($path); //get a directory listing $dir = array_diff (scandir ('.'), //folders / files to ignore array ('.DS_Store', 'Thumbs.db') ); //sort folders first, then by type, then alphabetically usort ($dir, create_function ('$a,$b', 'return is_dir ($a) ? (is_dir ($b) ? strnatcasecmp ($a, $b) : -1) : (is_dir ($b) ? 1 : ( strcasecmp (pathinfo ($a, PATHINFO_EXTENSION), pathinfo ($b, PATHINFO_EXTENSION)) == 0 ? strnatcasecmp ($a, $b) : strcasecmp (pathinfo ($a, PATHINFO_EXTENSION), pathinfo ($b, PATHINFO_EXTENSION)) )) ; ')); //echo to screen header ('content-type: text/plain'); print_r ($dir); ?>
Output for git.master, git.master_jit
Warning: chdir(): open_basedir restriction in effect. File(home/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/nfSh5 on line 7 Warning: scandir(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/nfSh5 on line 10 Warning: scandir(.): Failed to open directory: Operation not permitted in /in/nfSh5 on line 10 Warning: scandir(): (errno 1): Operation not permitted in /in/nfSh5 on line 10 Fatal error: Uncaught TypeError: array_diff(): Argument #1 ($array) must be of type array, bool given in /in/nfSh5:10 Stack trace: #0 /in/nfSh5(10): array_diff(false, Array) #1 {main} thrown in /in/nfSh5 on line 10
Process exited with code 255.
Output for rfc.property-hooks
Warning: chdir(): open_basedir restriction in effect. File(home/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/nfSh5 on line 7 Warning: scandir(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/nfSh5 on line 10 Warning: scandir(.): Failed to open directory: Operation not permitted in /in/nfSh5 on line 10 Warning: scandir(): (errno 1): Operation not permitted in /in/nfSh5 on line 10 Fatal error: Uncaught TypeError: array_diff(): Argument #1 ($array) must be of type array, false given in /in/nfSh5:10 Stack trace: #0 /in/nfSh5(10): array_diff(false, Array) #1 {main} thrown in /in/nfSh5 on line 10
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:
40.43 ms | 401 KiB | 8 Q