3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<? function getPrivateHeadersInArray($parentDirectory) { if ($handle = opendir("$parentDirectory")) { while (false !== ($file = readdir($handle))) { if (($file != "." && $file != "..") && !is_dir($file)) { chdir("$parentDirectory"); //to make sure you are always in right directory $holdcontents = file_get_contents($file); $items[] = get_header($holdcontents); } if(is_dir($file) && ($file != "." && $file != "..")) { $holdpwd = getcwd(); $newdir = "$holdpwd"."/$file"; getPrivateHeadersInArray($newdir); } } closedir($handle); } return $items; } ?>
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Output for 4.3.0 - 5.3.29
<? function getPrivateHeadersInArray($parentDirectory) { if ($handle = opendir("$parentDirectory")) { while (false !== ($file = readdir($handle))) { if (($file != "." && $file != "..") && !is_dir($file)) { chdir("$parentDirectory"); //to make sure you are always in right directory $holdcontents = file_get_contents($file); $items[] = get_header($holdcontents); } if(is_dir($file) && ($file != "." && $file != "..")) { $holdpwd = getcwd(); $newdir = "$holdpwd"."/$file"; getPrivateHeadersInArray($newdir); } } closedir($handle); } return $items; } ?>