3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[NoDiscard] function lockFile(string $path) { $handle = fopen($path, 'r+'); if (! $handle || ! flock($handle, LOCK_EX)) { throw new RuntimeException('Failed locking ' . $path); } return $handle; } // what we write function main() { lockFile($path); doSomething(); echo 'hi'; } // gets rewritten internally to something like function main() { $hidden = lockFile($path); doSomething(); echo 'hi'; unset($hidden); } // if we do assign it, we omit it all // what we write here would not get rewritten function main() { $handle = lockFile($path); doSomething(); echo 'hi'; } // if we were to ever get a "using"-like // what we write function main() { using { lockFile($path); doSomething(); } echo 'hi'; } // gets rewritten internally to something like function main() { $hidden = lockFile($path); doSomething(); unset($hidden); echo 'hi'; }
Output for git.master_jit, git.master
Parse error: syntax error, unexpected token "{" in /in/L4bOc on line 38
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:
143.97 ms | 1002 KiB | 7 Q