Get array value by multidim array of keys


/ Published in: PHP
Save to your folder(s)

The first argument is a variable name which value should be extracted from $array (second argument), or array of keys (multidim array is also supported).
The third argument is a default value which will be return on fail (false by default).

Usage examples:

1) $value = array_traverse('user[name]', $_POST);

2) $value = array_traverse(array('user' => array('name' => '')), $_POST);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.