3v4l.org

run code in 200+ 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 - 7.2.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; } ?>