3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = "/tmp/foo.txt"; file_put_contents($path, "123456"); $file = fopen($path, "r"); flock($file, LOCK_SH | LOCK_NB); `php -r "var_dump(file_put_contents('$file', 'baz'));"`; // should fail because locked clearstatcache(FALSE, $path); $fileSize = filesize($path); // should return 6 bytes but returns 0 echo $fileSize . "\n"; $contents = fread($file, $fileSize); flock($file, LOCK_UN); fclose($file); echo $contents;
Output for git.master_jit, git.master, rfc.property-hooks
Warning: shell_exec(): Unable to execute 'php -r "var_dump(file_put_contents('Resource id #6', 'baz'));"' in /in/OR0ZU on line 10 6 123456

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:
28.67 ms | 405 KiB | 5 Q