Merge remote-tracking branch 'origin/master'
[phpmyadmin.git] / libraries / util.lib.php
blob813252b8d681d37eb2ba40daa30fdebfeda5bf82
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Util file creation
6 * @package PhpMyAdmin
7 */
9 namespace PMA\Util;
11 if (! defined('PHPMYADMIN')) {
12 exit;
15 /**
16 * Access to a multidimensional array by dot notation
18 * @param array $array List of values
19 * @param string|array $path Path to searched value
20 * @param mixed $default Default value
22 * @return mixed Searched value
24 function get($array, $path, $default = null)
26 if (is_string($path)) {
27 $path = explode('.', $path);
29 $p = array_shift($path);
30 while (isset($p)) {
31 if (!isset($array[$p])) {
32 return $default;
34 $array = $array[$p];
35 $p = array_shift($path);
37 return $array;