3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fileHandle = fopen("php://memory", "w+"); $params = array('level' => 6, 'window' => 15, 'memory' => 9); //stream_filter_append($fileHandle, "string.rot13", STREAM_FILTER_WRITE, $params); stream_filter_append($fileHandle, 'zlib.deflate', STREAM_FILTER_WRITE, $params); $string = "Each of these code fragments is very simple, and easy to read and understand. One produces a character at a time by calling emit(); the other consumes a character at a time by calling getchar(). If only the calls to emit() and the calls to getchar() could be made to feed data to each other, it would be simple to connect the two fragments together so that the output from the decompressor went straight to the parser. In many modern operating systems, you could do this using pipes between two processes or two threads. emit() in the decompressor writes to a pipe, and getchar() in the parser reads from the other end of the same pipe. Simple and robust, but also heavyweight and not portable. Typically you don't want to have to divide your program into threads for a task this simple."; fwrite($fileHandle, $string); echo "Current position is: ".ftell($fileHandle)."\n"; rewind($fileHandle); //fseek($fileHandle, 0); //echo stream_get_contents($fileHandle); //echo "file position: ".filesize($fileHandle)."\n"; //echo "strlen = : ".strlen($string); fpassthru($fileHandle);
Output for 7.4.14 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
Current position is: 2 x��RKn�0 ���5|����*���E�B�H��}I)��"âf��~�CYAw����qK�U ܉HL��`@( ��^8s �� ^2A�΅�%T;jLs��#� (E}|�鳡؇m~�3}���:��i��J>Zo����F�.�'�f�G�� �-mW+Q�����}qQ7� �xX�Ӛi��^��mZl��#�nq@ʩ�TC��ρ��*�Ha����q�՛;�" ����Mcn�,�P*1�� M��ܠ��}��\���X�̙�"�]��cوUm�t�$e�p,�������r��/+�9Cp��H��0�Z��f���w�2��7��$<̹���.�8 �ZXq>����衶�{(��������'�=Z�`�{cL&U?w��v��Qކi#����
Output for 5.1.4 - 5.1.6, 5.2.0 - 5.2.5, 5.2.11 - 5.2.17, 5.3.1 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.13, 8.0.0
Current position is: 2 x�
Output for 5.3.0
Warning: stream_filter_append(): Invalid compression level specified. (46952780) in /in/MttZV on line 9 Current position is: 2 x�
Output for 5.2.6 - 5.2.10
Warning: stream_filter_append(): Invalid compression level specified. (4294967295) in /in/MttZV on line 9 Current position is: 2 x�
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.3
Warning: fopen(php://memory): failed to open stream: Success in /in/MttZV on line 4 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/MttZV on line 9 Warning: fwrite(): supplied argument is not a valid stream resource in /in/MttZV on line 15 Warning: ftell(): supplied argument is not a valid stream resource in /in/MttZV on line 17 Current position is: Warning: rewind(): supplied argument is not a valid stream resource in /in/MttZV on line 19 Warning: fpassthru(): supplied argument is not a valid stream resource in /in/MttZV on line 26
Output for 4.3.3 - 4.3.11, 4.4.0 - 4.4.9
Warning: fopen(php://memory): failed to open stream: Success in /in/MttZV on line 4 Notice: Use of undefined constant STREAM_FILTER_WRITE - assumed 'STREAM_FILTER_WRITE' in /in/MttZV on line 9 Warning: stream_filter_append() expects at most 3 parameters, 4 given in /in/MttZV on line 9 Warning: fwrite(): supplied argument is not a valid stream resource in /in/MttZV on line 15 Warning: ftell(): supplied argument is not a valid stream resource in /in/MttZV on line 17 Current position is: Warning: rewind(): supplied argument is not a valid stream resource in /in/MttZV on line 19 Warning: fpassthru(): supplied argument is not a valid stream resource in /in/MttZV on line 26
Output for 4.3.2
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/MttZV on line 4 Notice: Use of undefined constant STREAM_FILTER_WRITE - assumed 'STREAM_FILTER_WRITE' in /in/MttZV on line 9 Warning: stream_filter_append() expects at most 3 parameters, 4 given in /in/MttZV on line 9 Warning: fwrite(): supplied argument is not a valid stream resource in /in/MttZV on line 15 Warning: ftell(): supplied argument is not a valid stream resource in /in/MttZV on line 17 Current position is: Warning: rewind(): supplied argument is not a valid stream resource in /in/MttZV on line 19 Warning: fpassthru(): supplied argument is not a valid stream resource in /in/MttZV on line 26
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/MttZV on line 4 Notice: Use of undefined constant STREAM_FILTER_WRITE - assumed 'STREAM_FILTER_WRITE' in /in/MttZV on line 9 Warning: stream_filter_append() expects at most 3 parameters, 4 given in /in/MttZV on line 9 Warning: fwrite(): supplied argument is not a valid stream resource in /in/MttZV on line 15 Warning: ftell(): supplied argument is not a valid stream resource in /in/MttZV on line 17 Current position is: Warning: rewind(): supplied argument is not a valid stream resource in /in/MttZV on line 19 Warning: fpassthru(): supplied argument is not a valid stream resource in /in/MttZV on line 26

preferences:
147.93 ms | 419 KiB | 5 Q