protected function _insert(&$arr, $parts, $key, $value = null) { while ($pos = array_shift($parts)) { if (!isset($arr[$pos])) { $arr[$pos] = array(); } $arr =& $arr[$pos]; } if (is_null($value)) { $arr[] = $key; } else { $arr[$key] = $value; } }