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);

preferences:
27.26 ms | 409 KiB | 5 Q