Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // @ref http://stackoverflow.com/questions/7851590/array-set-value-using-dot-notation
- function set_value(&$arr, $path, $val)
- {
- $loc = &$arr;
- foreach(explode('.', $path) as $step)
- {
- if(!isset($loc[$step]))
- {
- $loc = &$loc[$step];
- }
- }
- return $loc = $val;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement