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 = 'dGVzdA=='; $stream = fopen('php://memory', 'r+'); fwrite($stream, $testString); rewind($stream); $filter = stream_filter_append($stream, 'convert.base64-decode'); echo "decode - 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; $testString = 'dGVzdA=='; $stream = fopen('php://temp', 'r+'); fwrite($stream, $testString); rewind($stream); $filter = stream_filter_append($stream, 'convert.base64-decode'); echo "decode - low-level - temp = " . stream_get_contents($stream) . PHP_EOL;
Output for 7.2.0 - 7.3.2
encode - low-level - memory = dGVzdA== decode - low-level - memory = test encode - low-level - temp = dGVz decode - low-level - temp = test
Output for 5.6.30 - 5.6.38, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.1.25
encode - low-level - memory = dGVzdA== decode - low-level - memory = test encode - low-level - temp = dGVzdA== decode - low-level - temp = test