3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tempdir($dir=false,$prefix='php') { $tempfile = tempnam(sys_get_temp_dir(),''); if (file_exists($tempfile)) { unlink($tempfile); } mkdir($tempfile); if (is_dir($tempfile)) { return $tempfile; } } function getFileCount($path) { $size = 0; $files = scandir($path); foreach($files as $t) { if ($t[0] == '.') { continue; } $name = rtrim($path, '/') . '/' . $t; if (is_dir($name)) { $size += getFileCount(rtrim($path, '/') . '/' . $t); } else { $size++; unlink($name); } } return $size; } $directory = dirname(__FILE__)."/tgz"; $iterator = new DirectoryIterator($directory); $files = array(); foreach ($iterator as $fileinfo) { if ($fileinfo->isFile()) { $files[$fileinfo->getPathname()] = $fileinfo->getFilename(); } } ksort($files); foreach ($files as $path => $file) { $p = new PharData($path); $tmpdir = tempdir(); $p->extractTo($tmpdir); var_dump($file); var_dump(getFileCount($tmpdir)); rmdir($tmpdir); }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(/in/tgz): Failed to open directory: No such file or directory in /in/KUTqI:33 Stack trace: #0 /in/KUTqI(33): DirectoryIterator->__construct('/in/tgz') #1 {main} thrown in /in/KUTqI on line 33
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:
68.72 ms | 401 KiB | 8 Q