src/Util/Arrays.php
public static function insertBefore(array &$arr, $key, array $inserted): void
    {
        $offset = (int) self::searchKey($arr, $key);
        $arr = \array_slice($arr, 0, $offset, true) + $inserted + \array_slice($arr, $offset, null, true);
    }
public static function insertBefore(array &$arr, $key, array $inserted): void
    {
        $offset = (int) self::searchKey($arr, $key);
        $arr = \array_slice($arr, 0, $offset, true) + $inserted + \array_slice($arr, $offset, null, true);
    }
public static function insertBefore ( array & $ arr , $ key , array $ inserted ) : void { $ offset = ( int ) self :: searchKey ( $ arr , $ key ) ; $ arr = \ array_slice ( $ arr , 0 , $ offset , true ) + $ inserted + \ array_slice ( $ arr , $ offset , null , true ) ; }
Inserts new array before item specified by key.

@param array      $arr
@param int|string $key
@param array      $inserted
Inserts new array before item specified by key .