3v4l.org

run code in 200+ PHP versions simultaneously
<?php $socket = fopen('php://memory', 'a+'); fwrite($socket, 'ab'); fseek($socket, 0); fwrite($socket, 'a'); var_dump(fgets($socket));
based on fMq6Z
Output for 5.1.4 - 7.2.10
string(1) "b"
Output for 4.3.5 - 5.1.3
Warning: fopen(php://memory): failed to open stream: Success in /in/2haHa on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/2haHa on line 4 Warning: fseek(): supplied argument is not a valid stream resource in /in/2haHa on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/2haHa on line 7 Warning: fgets(): supplied argument is not a valid stream resource in /in/2haHa on line 9 bool(false)
Output for 4.3.3 - 4.3.4
Warning: fopen(php://memory): failed to open stream: Success in /in/2haHa on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/2haHa on line 4 Warning: fseek(): supplied argument is not a valid stream resource in /in/2haHa on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/2haHa on line 7 Warning: fgets(): supplied argument is not a valid stream resource in /in/2haHa on line 9 NULL
Output for 4.3.2
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/2haHa on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/2haHa on line 4 Warning: fseek(): supplied argument is not a valid stream resource in /in/2haHa on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/2haHa on line 7 Warning: fgets(): supplied argument is not a valid stream resource in /in/2haHa on line 9 NULL
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/2haHa on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/2haHa on line 4 Warning: fseek(): supplied argument is not a valid stream resource in /in/2haHa on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/2haHa on line 7 Warning: fgets(): supplied argument is not a valid stream resource in /in/2haHa on line 9 NULL