$j ) { $var [$i] = trim ( $j ); } if ($type === self::HASH) { // key:value,key2:value2 $nvar = array (); foreach ( $var as $keypair ) { $c = explode ( ':', $keypair, 2 ); if (! isset ( $c [1] )) { continue; } $nvar [trim ( $c [0] )] = trim ( $c [1] ); } $var = $nvar; } } if (! is_array ( $var )) { break; } $keys = array_keys ( $var ); if ($keys === array_keys ( $keys )) { if ($type == self::ALIST) { return $var; } elseif ($type == self::LOOKUP) { $new = array (); foreach ( $var as $key ) { $new [$key] = true; } return $new; } else { break; } } if ($type === self::ALIST) { trigger_error ( "Array list did not have consecutive integer indexes", E_USER_WARNING ); return array_values ( $var ); } if ($type === self::LOOKUP) { foreach ( $var as $key => $value ) { if ($value !== true) { trigger_error ( "Lookup array has non-true value at key '$key'; " . "maybe your input array was not indexed numerically", E_USER_WARNING ); } $var [$key] = true; } } return $var; default : $this->errorInconsistent ( __CLASS__, $type ); } $this->errorGeneric ( $var, $type ); } } // vim: et sw=4 sts=4