src/Components/AbstractSegment.php
protected function appendSegment(array $left, array $value, $whence = null, $whence_index = null)
    {
        $right = array();
        if (null !== $whence && count($found = array_keys($left, $whence))) {
            array_reverse($found);
            $index = $found[0];
            if (array_key_exists($whence_index, $found)) {
                $index = $found[$whence_index];
            }
            $right = array_slice($left, $index+1);
            $left = array_slice($left, 0, $index+1);
        }

        return array_merge($left, $value, $right);
    }
protected function appendSegment(array $left, array $value, $whence = null, $whence_index = null)
    {
        $right = array();
        if (null !== $whence && count($found = array_keys($left, $whence))) {
            array_reverse($found);
            $index = $found[0];
            if (array_key_exists($whence_index, $found)) {
                $index = $found[$whence_index];
            }
            $right = array_slice($left, $index+1);
            $left = array_slice($left, 0, $index+1);
        }

        return array_merge($left, $value, $right);
    }
protected function appendSegment ( array $ left , array $ value , $ whence = null , $ whence_index = null ) { $ right = array ( ) ; if ( null !== $ whence && count ( $ found = array_keys ( $ left , $ whence ) ) ) { array_reverse ( $ found ) ; $ index = $ found [ 0 ] ; if ( array_key_exists ( $ whence_index , $ found ) ) { $ index = $ found [ $ whence_index ] ; } $ right = array_slice ( $ left , $ index + 1 ) ; $ left = array_slice ( $ left , 0 , $ index + 1 ) ; } return array_merge ( $ left , $ value , $ right ) ; }
Append some data to a given array

@param array   $left         the original array
@param array   $value        the data to prepend
@param string  $whence       the value of the data to prepend before
@param integer $whence_index the occurrence index for $whence

@return array
Append some data to a given array