3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tmp = fopen('php://temp', 'rw'); fwrite($tmp, "Hi\n"); fwrite($tmp, "I am a creature\r\n"); fwrite($tmp, "from your dreams\r"); fwrite($tmp, "stop\n"); fseek($tmp, 0); var_dump(ini_get('auto_detect_line_endings')); ini_set("auto_detect_line_endings", true); assert('fgets($tmp) === "Hi\n";'); assert('fgets($tmp) === "I am a creature\r\n";'); assert('fgets($tmp) === "from your dreams\r";');
based on mrq8m
Output for 7.2.0 - 7.2.6
string(1) "0" Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/h9svq on line 16 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/h9svq on line 17 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/h9svq on line 18 Warning: assert(): Assertion "fgets($tmp) === "from your dreams\r";" failed in /in/h9svq on line 18
Output for 5.1.4 - 7.1.20
string(1) "0" Warning: assert(): Assertion "fgets($tmp) === "from your dreams\r";" failed in /in/h9svq on line 18
Output for 4.3.3 - 5.1.3
Warning: fopen(php://temp): failed to open stream: Success in /in/h9svq on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 6 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 7 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 9 Warning: fseek(): supplied argument is not a valid stream resource in /in/h9svq on line 11 string(1) "0" Warning: fgets(): supplied argument is not a valid stream resource in /in/h9svq(16) : assert code on line 1 Warning: assert(): Assertion "fgets($tmp) === "Hi\n";" failed in /in/h9svq on line 16 Warning: fgets(): supplied argument is not a valid stream resource in /in/h9svq(17) : assert code on line 1 Warning: assert(): Assertion "fgets($tmp) === "I am a creature\r\n";" failed in /in/h9svq on line 17 Warning: fgets(): supplied argument is not a valid stream resource in /in/h9svq(18) : assert code on line 1 Warning: assert(): Assertion "fgets($tmp) === "from your dreams\r";" failed in /in/h9svq on line 18
Output for 4.3.2
Warning: fopen(php://temp): failed to open stream: Inappropriate ioctl for device in /in/h9svq on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 6 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 7 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 9 Warning: fseek(): supplied argument is not a valid stream resource in /in/h9svq on line 11 string(1) "0" Warning: fgets(): supplied argument is not a valid stream resource in /in/h9svq(16) : assert code on line 1 Warning: assert(): Assertion "fgets($tmp) === "Hi\n";" failed in /in/h9svq on line 16 Warning: fgets(): supplied argument is not a valid stream resource in /in/h9svq(17) : assert code on line 1 Warning: assert(): Assertion "fgets($tmp) === "I am a creature\r\n";" failed in /in/h9svq on line 17 Warning: fgets(): supplied argument is not a valid stream resource in /in/h9svq(18) : assert code on line 1 Warning: assert(): Assertion "fgets($tmp) === "from your dreams\r";" failed in /in/h9svq on line 18
Output for 4.3.0 - 4.3.1
Warning: fopen(php://temp) [http://www.php.net/function.fopen]: failed to create stream: Inappropriate ioctl for device in /in/h9svq on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 6 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 7 Warning: fwrite(): supplied argument is not a valid stream resource in /in/h9svq on line 9 Warning: fseek(): supplied argument is not a valid stream resource in /in/h9svq on line 11 string(1) "0" Warning: fgets(): supplied argument is not a valid stream resource in /in/h9svq(16) : assert code on line 1 Warning: assert() [http://www.php.net/function.assert]: Assertion "fgets($tmp) === "Hi\n";" failed in /in/h9svq on line 16 Warning: fgets(): supplied argument is not a valid stream resource in /in/h9svq(17) : assert code on line 1 Warning: assert() [http://www.php.net/function.assert]: Assertion "fgets($tmp) === "I am a creature\r\n";" failed in /in/h9svq on line 17 Warning: fgets(): supplied argument is not a valid stream resource in /in/h9svq(18) : assert code on line 1 Warning: assert() [http://www.php.net/function.assert]: Assertion "fgets($tmp) === "from your dreams\r";" failed in /in/h9svq on line 18