private function getValueAtKey($key, $data)
    {
        $keys = explode('.', $key);

        while (count($keys) > 1) {
            $key = array_shift($keys);

            // Wildcard Key
            if (preg_match($this->wildcards, $key) && is_array($data) && ! empty($data)) {
                // Shift the first item of the array
                if (preg_match('/^:(index|item)\[\d+\]$/', $key)) {
                    for ($x = substr($key, 7, -1); $x >= 0; $x--) {
                        if (empty($data)) {
                            return false;
                        }
                        $item = array_shift($data);
                    }
                } elseif ($key == ':last') {
                    $item = array_pop($data);
                } else {
                    $item = array_shift($data);
                }
                $data =& $item;
            } else {
                if ( ! isset($data[$key]) || ! is_array($data[$key])) {
                    return false;
                }

                $data =& $data[$key];
            }
        }

        // Return value
        $key = array_shift($keys);
        if (preg_match($this->wildcards, $key)) {
            if (preg_match('/^:(index|item)\[\d+\]$/', $key)) {
                for ($x = substr($key, 7, -1); $x >= 0; $x--) {
                    if (empty($data)) {
                        return false;
                    }
                    $item = array_shift($data);
                }
                return $item;
            } elseif ($key == ':last') {
                return array_pop($data);
            }
            return array_shift($data); // First Found
        }
        return ($data[$key]);
    }
private function getValueAtKey($key, $data)
    {
        $keys = explode('.', $key);

        while (count($keys) > 1) {
            $key = array_shift($keys);

            // Wildcard Key
            if (preg_match($this->wildcards, $key) && is_array($data) && ! empty($data)) {
                // Shift the first item of the array
                if (preg_match('/^:(index|item)\[\d+\]$/', $key)) {
                    for ($x = substr($key, 7, -1); $x >= 0; $x--) {
                        if (empty($data)) {
                            return false;
                        }
                        $item = array_shift($data);
                    }
                } elseif ($key == ':last') {
                    $item = array_pop($data);
                } else {
                    $item = array_shift($data);
                }
                $data =& $item;
            } else {
                if ( ! isset($data[$key]) || ! is_array($data[$key])) {
                    return false;
                }

                $data =& $data[$key];
            }
        }

        // Return value
        $key = array_shift($keys);
        if (preg_match($this->wildcards, $key)) {
            if (preg_match('/^:(index|item)\[\d+\]$/', $key)) {
                for ($x = substr($key, 7, -1); $x >= 0; $x--) {
                    if (empty($data)) {
                        return false;
                    }
                    $item = array_shift($data);
                }
                return $item;
            } elseif ($key == ':last') {
                return array_pop($data);
            }
            return array_shift($data); // First Found
        }
        return ($data[$key]);
    }
private function getValueAtKey ( $ key , $ data ) { $ keys = explode ( '.' , $ key ) ; while ( count ( $ keys ) > 1 ) { $ key = array_shift ( $ keys ) ; // Wildcard Key if ( preg_match ( $ this -> wildcards , $ key ) && is_array ( $ data ) && ! empty ( $ data ) ) { // Shift the first item of the array if ( preg_match ( '/^:(index|item)\[\d+\]$/' , $ key ) ) { for ( $ x = substr ( $ key , 7 , - 1 ) ; $ x >= 0 ; $ x -- ) { if ( empty ( $ data ) ) { return false ; } $ item = array_shift ( $ data ) ; } } elseif ( $ key == ':last' ) { $ item = array_pop ( $ data ) ; } else { $ item = array_shift ( $ data ) ; } $ data = & $ item ; } else { if ( ! isset ( $ data [ $ key ] ) || ! is_array ( $ data [ $ key ] ) ) { return false ; } $ data = & $ data [ $ key ] ; } } // Return value $ key = array_shift ( $ keys ) ; if ( preg_match ( $ this -> wildcards , $ key ) ) { if ( preg_match ( '/^:(index|item)\[\d+\]$/' , $ key ) ) { for ( $ x = substr ( $ key , 7 , - 1 ) ; $ x >= 0 ; $ x -- ) { if ( empty ( $ data ) ) { return false ; } $ item = array_shift ( $ data ) ; } return $ item ; } elseif ( $ key == ':last' ) { return array_pop ( $ data ) ; } return array_shift ( $ data ) ; // First Found } return ( $ data [ $ key ] ) ; }
Return a value from the array identified from the key.

@param $key
@param $data
@return mixed
Return a value from the array identified from the key .