3v4l.org

run code in 300+ PHP versions simultaneously
<?php $texto = "~0 11111111 ~1 222222222 ~2 3333333333 ~end ~0 aaaaaaaaaaa ~1 bbbbbbbbbb ~2 cccccccccc ~3 ddddddddddd ~end ~0 yyyyyyyyyyy xxxxxxxx ffffffffff ~1 rrrrrrrrrrrr ~end"; $sub_bloques = []; foreach(array_map('trim', explode("\n", $texto)) as $line) { if ($line && substr($line, 0, 1) !== '~') { $sub_bloques[] = $line; } if ($line == '~end') { $hola[] = $sub_bloques; $sub_bloques = []; } } var_dump($hola);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(3) { [0]=> string(8) "11111111" [1]=> string(9) "222222222" [2]=> string(10) "3333333333" } [1]=> array(4) { [0]=> string(11) "aaaaaaaaaaa" [1]=> string(10) "bbbbbbbbbb" [2]=> string(10) "cccccccccc" [3]=> string(11) "ddddddddddd" } [2]=> array(4) { [0]=> string(11) "yyyyyyyyyyy" [1]=> string(8) "xxxxxxxx" [2]=> string(10) "ffffffffff" [3]=> string(12) "rrrrrrrrrrrr" } }

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:
52.96 ms | 1676 KiB | 4 Q