3v4l.org

run code in 200+ php & hhvm versions
<?php $testString = 'test'; $stream = fopen('php://memory', 'r+'); fwrite($stream, $testString); rewind($stream); $filter = stream_filter_append($stream, 'convert.base64-encode'); echo "encode - low-level - memory = " . stream_get_contents($stream) . PHP_EOL; $testString = 'test'; $stream = fopen('php://temp', 'r+'); fwrite($stream, $testString); rewind($stream); $filter = stream_filter_append($stream, 'convert.base64-encode'); echo "encode - low-level - temp = " . stream_get_contents($stream) . PHP_EOL;
based on pXjk4
Output for 7.2.0 - 7.3.3
encode - low-level - memory = dGVzdA== encode - low-level - temp = dGVz
Output for 5.1.4 - 5.1.6, 5.5.21 - 5.5.38, 5.6.5 - 5.6.40, hhvm-3.15.4 - 3.22.0, 7.0.0 - 7.1.27
encode - low-level - memory = dGVzdA== encode - low-level - temp = dGVzdA==
Output for hhvm-3.10.1 - 3.13.2
Warning: stream_filter_append(): unable to locate filter "convert.base64-encode" in /in/NnFV2 on line 6 encode - low-level - memory = test Warning: stream_filter_append(): unable to locate filter "convert.base64-encode" in /in/NnFV2 on line 12 encode - low-level - temp = test
Output for 5.2.0 - 5.5.20, 5.6.0 - 5.6.4
encode - low-level - memory = dGVz encode - low-level - temp = dGVz
Output for 5.0.2 - 5.1.3
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/NnFV2 on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/NnFV2 on line 4 Warning: rewind(): supplied argument is not a valid stream resource in /in/NnFV2 on line 5 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 6 Warning: stream_get_contents() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 7 encode - low-level - memory = Warning: fopen(php://temp): failed to open stream: Inappropriate ioctl for device in /in/NnFV2 on line 9 Warning: fwrite(): supplied argument is not a valid stream resource in /in/NnFV2 on line 10 Warning: rewind(): supplied argument is not a valid stream resource in /in/NnFV2 on line 11 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 12 Warning: stream_get_contents() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 13 encode - low-level - temp =
Output for 5.0.0 - 5.0.1
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/NnFV2 on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/NnFV2 on line 4 Warning: rewind(): supplied argument is not a valid stream resource in /in/NnFV2 on line 5 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 6 Warning: stream_get_contents() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 7 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NnFV2 on line 7 encode - low-level - memory = PHP_EOL Warning: fopen(php://temp): failed to open stream: Inappropriate ioctl for device in /in/NnFV2 on line 9 Warning: fwrite(): supplied argument is not a valid stream resource in /in/NnFV2 on line 10 Warning: rewind(): supplied argument is not a valid stream resource in /in/NnFV2 on line 11 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 12 Warning: stream_get_contents() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NnFV2 on line 13 encode - low-level - temp = PHP_EOL
Output for 4.4.5 - 4.4.9
Warning: fopen(php://memory): failed to open stream: Success in /in/NnFV2 on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/NnFV2 on line 4 Warning: rewind(): supplied argument is not a valid stream resource in /in/NnFV2 on line 5 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 6 Fatal error: Call to undefined function: stream_get_contents() in /in/NnFV2 on line 7
Process exited with code 255.
Output for 4.3.3 - 4.4.4
Warning: fopen(php://memory): failed to open stream: Success in /in/NnFV2 on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/NnFV2 on line 4 Warning: rewind(): supplied argument is not a valid stream resource in /in/NnFV2 on line 5 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 6 Fatal error: Call to undefined function: stream_get_contents() in /in/NnFV2 on line 7
Process exited with code 255.
Output for 4.3.2
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/NnFV2 on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/NnFV2 on line 4 Warning: rewind(): supplied argument is not a valid stream resource in /in/NnFV2 on line 5 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 6 Fatal error: Call to undefined function: stream_get_contents() in /in/NnFV2 on line 7
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/NnFV2 on line 3 Warning: fwrite(): supplied argument is not a valid stream resource in /in/NnFV2 on line 4 Warning: rewind(): supplied argument is not a valid stream resource in /in/NnFV2 on line 5 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/NnFV2 on line 6 Fatal error: Call to undefined function: stream_get_contents() in /in/NnFV2 on line 7