3v4l.org

run code in 300+ PHP versions simultaneously
<?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 5.6.38, 7.0.33, 7.1.0 - 7.1.33, 7.4.14 - 7.4.33, 8.0.1 - 8.0.26, 8.1.0 - 8.1.13
encode - low-level - memory = dGVzdA== decode - low-level - memory = test encode - low-level - temp = dGVzdA== decode - low-level - temp = test
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.13, 8.0.0
encode - low-level - memory = dGVzdA== decode - low-level - memory = test encode - low-level - temp = dGVz decode - low-level - temp = test

preferences:
78.66 ms | 422 KiB | 17 Q