3v4l.org

run code in 300+ PHP versions simultaneously
<?php $segments = [1,2,3,4,5,6,7,8,9,1]; $box_size = 4; $input = 'Loremipsumdolorsitametconsecteturadipiscingeli'; $output = []; function string_to_stream($string) { $in = fopen('php://memory','r+'); fwrite($in, $string); rewind($in); return $in; } $stream = string_to_stream($input); $left_over = ''; while (($segment = array_shift($segments)) !== null) { while (strlen($left_over) < $segment) { $left_over .= fread($stream, $box_size); } $output[] = substr($left_over, 0, $segment); $left_over = substr($left_over, $segment); } if (implode('', $output) === $input) { echo 'Algorithm Correct !' . PHP_EOL . PHP_EOL; } foreach ($output as $v) { echo $v . PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
Algorithm Correct ! L or emi psum dolor sitame tconsec teturadi piscingel i

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
62.43 ms | 401 KiB | 8 Q