<?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);
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`