3v4l.org

run code in 300+ PHP versions simultaneously
<?php function rglob($pattern, $flags = 0) { $files = glob($pattern, $flags); foreach(glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags)); } return $files; } foreach(rglob(getcwd().'/*', GLOB_ONLYDIR) as $f){ printf("<h1>dir: %s perms: %s writable: %s</h1><br>", $f, substr(sprintf('%o', fileperms($f)), -4), is_writable($f) ? 'True' : 'False'); }
Output for 8.1.28, 8.2.17 - 8.2.18, 8.3.4 - 8.3.6
<h1>dir: /etc perms: 0755 writable: False</h1><br><h1>dir: /in perms: 0755 writable: False</h1><br><h1>dir: /tmp perms: 1777 writable: True</h1><br><h1>dir: /etc/ld.so.conf.d perms: 0755 writable: False</h1><br><h1>dir: /etc/pacman.d perms: 0755 writable: False</h1><br><h1>dir: /etc/profile.d perms: 0755 writable: False</h1><br><h1>dir: /etc/skel perms: 0755 writable: False</h1><br>
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 8.0.0 - 8.0.12

Process exited with code 137.
Output for 4.3.0 - 4.3.6, 4.3.9 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
Output for 4.3.7 - 4.3.8
<br /> <b>Warning</b>: Invalid argument supplied for foreach() in <b>/in/MZbta</b> on line <b>5</b><br /> <br /> <b>Warning</b>: Invalid argument supplied for foreach() in <b>/in/MZbta</b> on line <b>10</b><br />

preferences:
292.08 ms | 402 KiB | 392 Q