<?php $array = []; $lastChar = null; foreach (str_split('10001101') as $char) { if ($char !== $lastChar) { unset($ref); $array[] = &$ref; $ref = $char; $lastChar = $char; } else { $ref .= $char; } } var_export($array);
You have javascript disabled. You will not be able to edit any code.