3v4l.org

run code in 300+ PHP versions simultaneously
<?php $users = array(); $homepaths = array(); $configlist = array( 'config.php', 'config.inc.php', 'db.inc.php', 'connect.php', 'wp-config.php', 'var.php', 'configure.php', 'database.php', 'db.php', 'configuration.php', 'db_connect.php'); $var = '/var/mail/'; if (is_readable($var) & is_dir($var)) { $userlist = rglob('{*}', GLOB_BRACE, $var); } else { die("cant grab users from {$var}"); } if (!empty($userlist)) { foreach ($userlist as $user) { array_push($users, preg_replace('/^.+[\\\\\\/]/', '', $user)); } } foreach ($users as $usr) { $path = "/home/{$usr}/public_html/"; if (is_dir($path)) { array_push($homepaths, $path); } } foreach ($homepaths as $home) { if (is_dir($home)) { $fileList = rglob('{*.php}', GLOB_BRACE, $home); if (!empty($fileList)) { foreach ($fileList as $f) { //if (in_array(preg_replace('/^.+[\\\\\\/]/', '', $f), $configlist)) { echo $f; // } } } } } /* rglob func borrowed from https://github.com/hm2k/hm2k-php/blob/master/functions/rglob.php */ function rglob($pattern = '*', $flags = 0, $path = '') { $paths = glob($path . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT); $files = glob($path . $pattern, $flags); foreach ($paths as $path) { $files = array_merge($files, rglob($pattern, $flags, $path)); } return $files; } ?>
Output for 7.4.27 - 7.4.32, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: is_readable(): open_basedir restriction in effect. File(/var/mail/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/KYZJo on line 19 Warning: is_dir(): open_basedir restriction in effect. File(/var/mail/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/KYZJo on line 19 cant grab users from /var/mail/
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.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.33, 7.4.0 - 7.4.26, 7.4.33, 8.0.0 - 8.0.13
Output for 4.3.7 - 4.3.8
<br /> <b>Warning</b>: Invalid argument supplied for foreach() in <b>/in/KYZJo</b> on line <b>57</b><br />

preferences:
340.02 ms | 401 KiB | 468 Q