Divi_Helpers::array_get( $array,  $address, string $default = '' )

Pseudo function copied from Divi


Parameters Parameters

$array

(Required)

$address

(Required)

$default

(Optional)

Default value: ''


Top ↑

Return Return

(mixed|string)


Source Source

File: src/integrations/divi/helpers/divi-helpers.php

	public static function array_get( $array, $address, $default = '' ) {
		$keys  = is_array( $address ) ? $address : explode( '.', $address );
		$value = $array;

		foreach ( $keys as $key ) {
			if ( ! empty( $key ) && isset( $key[0] ) && '[' === $key[0] ) {
				$index = substr( $key, 1, - 1 );

				if ( is_numeric( $index ) ) {
					$key = (int) $index;
				}
			}

			if ( ! isset( $value[ $key ] ) ) {
				return $default;
			}

			$value = $value[ $key ];
		}

		return $value;
	}