<?php $input = '1,Home,3,Services,6,Service 1,7,Service 2,2,Products'; $keysAndValues = explode(',', $input); $result = []; $count = count($keysAndValues); for ($i = 0; $i < $count; $i+=2) { $key = $keysAndValues[$i]; $value = $keysAndValues[$i+1]; $result[$key] = $value; } var_dump($result);
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`