3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('magic_quotes_runtime', 1); $stream = fopen('php://memory', 'w+'); fwrite($stream, 'a\\"'); var_dump(fwrite($stream, 'a\\"', 2)); ini_set('magic_quotes_runtime', 0); rewind($stream); var_dump(stream_get_contents($stream)); fclose($stream);
based on Xfhkc
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.30, 7.0.0 - 7.0.23, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.21, 7.4.0 - 7.4.10, 8.0.0alpha1 - beta3
int(2) string(5) "a\"a\"
Output for 5.1.4 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
int(1) string(3) "a"a"
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.3
Warning: fopen(php://memory): failed to open stream: Success in /in/KLqJ9 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 6 bool(false) Warning: rewind(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 8 Warning: stream_get_contents() expects parameter 1 to be resource, boolean given in /in/KLqJ9 on line 9 bool(false) Warning: fclose(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 10
Output for 4.4.5 - 4.4.9
Warning: fopen(php://memory): failed to open stream: Success in /in/KLqJ9 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 6 bool(false) Warning: rewind(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 8 Fatal error: Call to undefined function: stream_get_contents() in /in/KLqJ9 on line 9
Process exited with code 255.
Output for 4.3.5 - 4.3.11, 4.4.0 - 4.4.4
Warning: fopen(php://memory): failed to open stream: Success in /in/KLqJ9 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 6 bool(false) Warning: rewind(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 8 Fatal error: Call to undefined function: stream_get_contents() in /in/KLqJ9 on line 9
Process exited with code 255.
Output for 4.3.3 - 4.3.4
Warning: fopen(php://memory): failed to open stream: Success in /in/KLqJ9 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 6 NULL Warning: rewind(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 8 Fatal error: Call to undefined function: stream_get_contents() in /in/KLqJ9 on line 9
Process exited with code 255.
Output for 4.3.2
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/KLqJ9 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 6 NULL Warning: rewind(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 8 Fatal error: Call to undefined function: stream_get_contents() in /in/KLqJ9 on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: fopen(php://memory) [http://www.php.net/function.fopen]: failed to create stream: Inappropriate ioctl for device in /in/KLqJ9 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 6 NULL Warning: rewind(): supplied argument is not a valid stream resource in /in/KLqJ9 on line 8 Fatal error: Call to undefined function: stream_get_contents() in /in/KLqJ9 on line 9