# gutenberg/8.3.0/lib/utils.php

Gutenberg, version 8.3.0. 28 lines.

- Page: https://pluginprobe.com/plugins/gutenberg/8.3.0/code/lib/utils.php
- Raw: https://pluginprobe.com/plugins/gutenberg/8.3.0/raw/lib/utils.php
- Modified: 2020-06-11T09:46:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gutenberg/8.3.0/code/lib/utils.php#L10-L20`.

```php
<?php
/**
 * General utilities.
 *
 * @package gutenberg
 */

/**
 * This function allows to easily access a part from a php array.
 * It is equivalent to want lodash get provides for JavaScript and is useful to have something similar
 * in php so functions that do the same thing on the client and sever can have identical code.
 *
 * @param array $array  An array from where we want to retrieve some information from.
 * @param array $path   An array containing the path we want to retrieve.
 *
 * @return array Containing a set of css rules.
 */
function gutenberg_experimental_get( $array, $path ) {
	$path_length = count( $path );
	for ( $i = 0; $i < $path_length; ++$i ) {
		if ( empty( $array[ $path[ $i ] ] ) ) {
			return null;
		}
		$array = $array[ $path[ $i ] ];
	}
	return $array;
}

```
