<?php $array = [10, -1, -1, -1, -1, 15, 16, 17, -1, -1, 20]; $result = []; foreach ($array as $v) { if ($v === -1) { unset($ref); continue; } if (!isset($ref)) { $result[] =& $ref; } $ref[] = $v; } var_export($result);
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`