<?php function toArray($string) { $chars = str_split($string); $array = array_reduce($chars, function($result, $current) { $previous = $result[] = array_pop($result); if (is_numeric($previous) && is_numeric($current)) { $result[] = array_pop($result) . $current; } else { $result[] = $current; } return $result; }, []); return array_slice($array, 1); } $input = '6+4*4+100+444*6*13*14'; print_r(toArray($input));
You have javascript disabled. You will not be able to edit any code.