3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $latin1 = base64_decode('UXVhbmQgSWxzIEF2YWllbnQgTW9uIMJnZSAtIDQwIEFucyBEZXZhbnQgTGEgVOls6SAoRXQgQXV0b3VyLi4uKQ'); $fp = fopen('php://memory', 'rb+'); fwrite($fp, $latin1); fseek($fp, 0); //$fp = fopen('compress.zlib://effiliation_BOOKS.csv.gz', 'rb'); stream_filter_prepend($fp, 'convert.iconv.ISO-8859-1/UTF-8', STREAM_FILTER_READ); /* while (! feof($fp)) { $line = fgets($fp, 64 * 1024); if (! mb_check_encoding($line, 'UTF-8')) { echo $line; } } */ $utf8 = stream_get_contents($fp); fclose($fp); echo mb_check_encoding($utf8, 'UTF-8');
based on S2SJK
Output for 5.1.4 - 5.5.34, 5.6.0 - 5.6.20, 5.6.28 - 7.0.5, 7.0.14 - 7.2.6
1
Output for 5.5.35 - 5.5.38, 5.6.21 - 5.6.25, 7.0.6 - 7.0.10
Warning: stream_filter_prepend(): unable to create or locate filter "convert.iconv.ISO-8859-1/UTF-8" in /in/5ad86 on line 9
Output for 5.1.3
Warning: fopen(php://memory): failed to open stream: Success in /in/5ad86 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/5ad86 on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/5ad86 on line 6 Warning: stream_filter_prepend() expects parameter 1 to be resource, boolean given in /in/5ad86 on line 9 Warning: stream_get_contents() expects parameter 1 to be resource, boolean given in /in/5ad86 on line 18 Warning: fclose(): supplied argument is not a valid stream resource in /in/5ad86 on line 19 1
Output for 5.0.0 - 5.1.2
Warning: fopen(php://memory): failed to open stream: Success in /in/5ad86 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/5ad86 on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/5ad86 on line 6 Warning: stream_filter_prepend() expects parameter 1 to be resource, boolean given in /in/5ad86 on line 9 Warning: stream_get_contents() expects parameter 1 to be resource, boolean given in /in/5ad86 on line 18 Warning: fclose(): supplied argument is not a valid stream resource in /in/5ad86 on line 19 Fatal error: Call to undefined function mb_check_encoding() in /in/5ad86 on line 21
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Warning: fopen(php://memory): failed to open stream: Success in /in/5ad86 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/5ad86 on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/5ad86 on line 6 Notice: Use of undefined constant STREAM_FILTER_READ - assumed 'STREAM_FILTER_READ' in /in/5ad86 on line 9 Warning: stream_filter_prepend() expects parameter 1 to be resource, boolean given in /in/5ad86 on line 9 Fatal error: Call to undefined function: stream_get_contents() in /in/5ad86 on line 18
Process exited with code 255.
Output for 4.3.3 - 4.4.4
Warning: fopen(php://memory): failed to open stream: Success in /in/5ad86 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/5ad86 on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/5ad86 on line 6 Notice: Use of undefined constant STREAM_FILTER_READ - assumed 'STREAM_FILTER_READ' in /in/5ad86 on line 9 Warning: stream_filter_prepend() expects parameter 1 to be resource, boolean given in /in/5ad86 on line 9 Fatal error: Call to undefined function: stream_get_contents() in /in/5ad86 on line 18
Process exited with code 255.
Output for 4.3.2
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/5ad86 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/5ad86 on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/5ad86 on line 6 Notice: Use of undefined constant STREAM_FILTER_READ - assumed 'STREAM_FILTER_READ' in /in/5ad86 on line 9 Warning: stream_filter_prepend() expects parameter 1 to be resource, boolean given in /in/5ad86 on line 9 Fatal error: Call to undefined function: stream_get_contents() in /in/5ad86 on line 18
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/5ad86 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/5ad86 on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/5ad86 on line 6 Notice: Use of undefined constant STREAM_FILTER_READ - assumed 'STREAM_FILTER_READ' in /in/5ad86 on line 9 Warning: stream_filter_prepend() expects parameter 1 to be resource, boolean given in /in/5ad86 on line 9 Fatal error: Call to undefined function: stream_get_contents() in /in/5ad86 on line 18