a::inject PHP Method

inject() static public method

Injects an element into an array
static public inject ( array $array, integer $position, mixed $element = 'placeholder' ) : array
$array array The source array
$position integer The position, where to inject the element
$element mixed The element, which should be injected
return array The result array including the new element
    static function inject($array, $position, $element = 'placeholder')
    {
        $start = array_slice($array, 0, $position);
        $end = array_slice($array, $position);
        return array_merge($start, (array) $element, $end);
    }