src/Panda/Support/Helpers/ArrayHelper.php
public static function get($array, $key = null, $default = null, $useDotSyntax = false)
    {
        // Check arguments
        if (empty($array)) {
            return $default;
        }

        // Check if key is empty
        if (is_null($key)) {
            return $array;
        }

        // Check if value exists as is
        if (isset($array[$key])) {
            return $array[$key];
        }

        // Return default value, without dot syntax
        if (!$useDotSyntax) {
            return $default;
        }

        // Split name using dots
        $keyParts = explode('.', $key);
        if (count($keyParts) == 1) {
            return isset($array[$key]) ? $array[$key] : $default;
        }

        // Recursive call
        $base = $keyParts[0];
        unset($keyParts[0]);

        // Check if the base array exists
        if (!isset($array[$base])) {
            return $default;
        }

        // Get key, base array and continue
        $key = implode('.', $keyParts);
        $array = $array[$base];

        return static::get($array, $key, $default, $useDotSyntax);
    }
public static function get($array, $key = null, $default = null, $useDotSyntax = false)
    {
        // Check arguments
        if (empty($array)) {
            return $default;
        }

        // Check if key is empty
        if (is_null($key)) {
            return $array;
        }

        // Check if value exists as is
        if (isset($array[$key])) {
            return $array[$key];
        }

        // Return default value, without dot syntax
        if (!$useDotSyntax) {
            return $default;
        }

        // Split name using dots
        $keyParts = explode('.', $key);
        if (count($keyParts) == 1) {
            return isset($array[$key]) ? $array[$key] : $default;
        }

        // Recursive call
        $base = $keyParts[0];
        unset($keyParts[0]);

        // Check if the base array exists
        if (!isset($array[$base])) {
            return $default;
        }

        // Get key, base array and continue
        $key = implode('.', $keyParts);
        $array = $array[$base];

        return static::get($array, $key, $default, $useDotSyntax);
    }
public static function get ( $ array , $ key = null , $ default = null , $ useDotSyntax = false ) { // Check arguments if ( empty ( $ array ) ) { return $ default ; } // Check if key is empty if ( is_null ( $ key ) ) { return $ array ; } // Check if value exists as is if ( isset ( $ array [ $ key ] ) ) { return $ array [ $ key ] ; } // Return default value, without dot syntax if ( ! $ useDotSyntax ) { return $ default ; } // Split name using dots $ keyParts = explode ( '.' , $ key ) ; if ( count ( $ keyParts ) == 1 ) { return isset ( $ array [ $ key ] ) ? $ array [ $ key ] : $ default ; } // Recursive call $ base = $ keyParts [ 0 ] ; unset ( $ keyParts [ 0 ] ) ; // Check if the base array exists if ( ! isset ( $ array [ $ base ] ) ) { return $ default ; } // Get key, base array and continue $ key = implode ( '.' , $ keyParts ) ; $ array = $ array [ $ base ] ; return static :: get ( $ array , $ key , $ default , $ useDotSyntax ) ; }
Get an item from an array.

@param array  $array
@param string $key
@param mixed  $default
@param bool   $useDotSyntax

@return mixed
Get an item from an array .