3v4l.org

run code in 300+ PHP versions simultaneously
<?php unlink('/tmp/test.phar'); $phar = new Phar('/tmp/test.phar'); $phar->startBuffering(); $phar->addFromString('1.php', 'test'); $phar->addFromString('2.php', 'test'); $phar->addFromString('inner/3.php', 'test'); $phar->stopBuffering(); $phar->rewind(); // string(24) "phar:///tmp/test.phar/" var_dump($phar->key()); // Не выведет ничего // foreach ($phar as $k => $v) { /* ... */ } // А так выведет foreach ($phar->getChildren() as $k => $v) { var_dump($k); var_dump($v); } // А так выведет даже с подкаталогами $iter = new RecursiveIteratorIterator($phar->getChildren()); foreach ($iter as $k => $v) { var_dump($k); var_dump($v); }
Output for git.master_jit, git.master, rfc.property-hooks
Warning: unlink(/tmp/test.phar): No such file or directory in /in/YvbU3 on line 3 Fatal error: Uncaught UnexpectedValueException: creating archive "/tmp/test.phar" disabled by the php.ini setting phar.readonly in /in/YvbU3:4 Stack trace: #0 /in/YvbU3(4): Phar->__construct('/tmp/test.phar') #1 {main} thrown in /in/YvbU3 on line 4
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:
27.49 ms | 406 KiB | 5 Q