3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Get 10mb of data from /dev/zero try { $infp = fopen('/dev/zero', 'r'); $data = fread($infp, 1024 * 1024 * 10); } finally { if (isset($infp) && $infp !== false) { echo "closing!"; fclose($infp); } } write_data($data); echo "Peak memory usage: ", number_format(memory_get_peak_usage()), " bytes\n"; /** * Bad example of how to write some data to /dev/null */ function write_data($data) { $outfp = fopen('/dev/null', 'w'); fwrite($outfp, $data); fwrite($outfp, "\n"); fclose($outfp); }
Output for git.master, git.master_jit
Warning: fopen(): open_basedir restriction in effect. File(/dev/zero) is not within the allowed path(s): (/tmp:/in:/etc) in /in/pR5Zp on line 6 Warning: fopen(/dev/zero): Failed to open stream: Operation not permitted in /in/pR5Zp on line 6 Fatal error: Uncaught TypeError: fread(): Argument #1 ($stream) must be of type resource, bool given in /in/pR5Zp:7 Stack trace: #0 /in/pR5Zp(7): fread(false, 10485760) #1 {main} thrown in /in/pR5Zp on line 7
Process exited with code 255.
Output for rfc.property-hooks
Warning: fopen(): open_basedir restriction in effect. File(/dev/zero) is not within the allowed path(s): (/tmp:/in:/etc) in /in/pR5Zp on line 6 Warning: fopen(/dev/zero): Failed to open stream: Operation not permitted in /in/pR5Zp on line 6 Fatal error: Uncaught TypeError: fread(): Argument #1 ($stream) must be of type resource, false given in /in/pR5Zp:7 Stack trace: #0 /in/pR5Zp(7): fread(false, 10485760) #1 {main} thrown in /in/pR5Zp on line 7
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:
45.81 ms | 401 KiB | 8 Q