if (reset($stk) == self::JSON_IN_ARR) {// we are in an array, so just push an element onto the stack$arr[] = self::decode($slice,$useArray);

} elseif (reset($stk) == self::JSON_IN_OBJ) {// we are in an object, so figure // out the property name and set an // element in an associative array, // for nowif (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {// "name":value pair$key = self::decode($parts[1],$useArray);$val = self::decode($parts[2],$useArray);

case 'array':/* * As per JSON spec if any array key is not an integer * we must treat the the whole array as an object. We * also try to catch a sparsely populated associative * array with numeric keys here because some JS engines * will create an array with empty indexes up to * max_index which can cause memory issues and because * the keys, which may be relevant, will be remapped * otherwise. * * As per the ECMA and JSON specification an object may * have any string as a property. Unfortunately due to * a hole in the ECMA specification if the key is a * ECMA reserved word or starts with a digit the * parameter is only accessible using ECMAScript's * bracket notation. */