private function addValue(&$array, $name, $value)
    {
        $nameParts = preg_split('/\\]\\[|\\[/s', $name);
        $current = &$array;
        foreach ($nameParts as $namePart) {
            $namePart = trim($namePart, ']');
            if ($namePart === '') {
                $current[] = [];
                $keys = array_keys($current);
                $lastKey = array_pop($keys);
                $current = &$current[$lastKey];
            } else {
                if (!isset($current[$namePart])) {
                    $current[$namePart] = [];
                }
                $current = &$current[$namePart];
            }
        }
        $current = $value;
    }
private function addValue(&$array, $name, $value)
    {
        $nameParts = preg_split('/\\]\\[|\\[/s', $name);
        $current = &$array;
        foreach ($nameParts as $namePart) {
            $namePart = trim($namePart, ']');
            if ($namePart === '') {
                $current[] = [];
                $keys = array_keys($current);
                $lastKey = array_pop($keys);
                $current = &$current[$lastKey];
            } else {
                if (!isset($current[$namePart])) {
                    $current[$namePart] = [];
                }
                $current = &$current[$namePart];
            }
        }
        $current = $value;
    }
private function addValue ( & $ array , $ name , $ value ) { $ nameParts = preg_split ( '/\\]\\[|\\[/s' , $ name ) ; $ current = & $ array ; foreach ( $ nameParts as $ namePart ) { $ namePart = trim ( $ namePart , ']' ) ; if ( $ namePart === '' ) { $ current [ ] = [ ] ; $ keys = array_keys ( $ current ) ; $ lastKey = array_pop ( $ keys ) ; $ current = & $ current [ $ lastKey ] ; } else { if ( ! isset ( $ current [ $ namePart ] ) ) { $ current [ $ namePart ] = [ ] ; } $ current = & $ current [ $ namePart ] ; } } $ current = $ value ; }
Adds value to the array by input name, e.g. `Item[name]`.
@param array $array array which should store value.
@param string $name input name specification.
@param mixed $value value to be added.
Adds value to the array by input name e . g . Item [ name ] .