3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(-1); function gzdecode_filler( $data, $length = 0 ) { $fp = fopen( 'php://memory', 'r+' ); fwrite( $fp, $data ); fseek( $fp, 0 ); stream_filter_append( $fp, 'zlib.inflate', STREAM_FILTER_READ ); $length = (int)$length; $max = 32768 * strlen( $data ); $max = $length ? min( $length, $max ) : $max; $decoded = fread( $fp, $max + 1 ); if ( $decoded === false || strlen( $decoded ) > $max ) { return false; } return $decoded; } var_dump(gzdecode_filler(pack('H*', "1f8b08000000000000030bc94855282ccd4cce56482aca2fcf5348cbaf50c82acd2d2856c82f4b2d5228014ae72456552aa4e4a7eb0100e92590512c000000")));
Output for 5.1.4 - 5.6.28, 7.0.0 - 7.1.0
string(0) ""
Output for hhvm-3.10.0 - 3.12.0
Warning: Failed to extract chunk string(0) ""
Output for 5.0.0 - 5.1.3
Warning: fopen(php://memory): failed to open stream: Success in /in/MiQZA on line 6 Warning: fwrite(): supplied argument is not a valid stream resource in /in/MiQZA on line 7 Warning: fseek(): supplied argument is not a valid stream resource in /in/MiQZA on line 8 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/MiQZA on line 9 Warning: fread(): supplied argument is not a valid stream resource in /in/MiQZA on line 15 bool(false)
Output for 4.3.5 - 4.4.9
Warning: fopen(php://memory): failed to open stream: Success in /in/MiQZA on line 6 Warning: fwrite(): supplied argument is not a valid stream resource in /in/MiQZA on line 7 Warning: fseek(): supplied argument is not a valid stream resource in /in/MiQZA on line 8 Notice: Use of undefined constant STREAM_FILTER_READ - assumed 'STREAM_FILTER_READ' in /in/MiQZA on line 9 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/MiQZA on line 9 Warning: fread(): supplied argument is not a valid stream resource in /in/MiQZA on line 15 bool(false)
Output for 4.3.3 - 4.3.4
Warning: fopen(php://memory): failed to open stream: Success in /in/MiQZA on line 6 Warning: fwrite(): supplied argument is not a valid stream resource in /in/MiQZA on line 7 Warning: fseek(): supplied argument is not a valid stream resource in /in/MiQZA on line 8 Notice: Use of undefined constant STREAM_FILTER_READ - assumed 'STREAM_FILTER_READ' in /in/MiQZA on line 9 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/MiQZA on line 9 Warning: fread(): supplied argument is not a valid stream resource in /in/MiQZA on line 15 NULL
Output for 4.3.2
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/MiQZA on line 6 Warning: fwrite(): supplied argument is not a valid stream resource in /in/MiQZA on line 7 Warning: fseek(): supplied argument is not a valid stream resource in /in/MiQZA on line 8 Notice: Use of undefined constant STREAM_FILTER_READ - assumed 'STREAM_FILTER_READ' in /in/MiQZA on line 9 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/MiQZA on line 9 Warning: fread(): supplied argument is not a valid stream resource in /in/MiQZA on line 15 NULL
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/MiQZA on line 6 Warning: fwrite(): supplied argument is not a valid stream resource in /in/MiQZA on line 7 Warning: fseek(): supplied argument is not a valid stream resource in /in/MiQZA on line 8 Notice: Use of undefined constant STREAM_FILTER_READ - assumed 'STREAM_FILTER_READ' in /in/MiQZA on line 9 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/MiQZA on line 9 Warning: fread(): supplied argument is not a valid stream resource in /in/MiQZA on line 15 NULL