@@ 688-698 (lines=11) @@ | ||
685 | * @throws \InvalidArgumentException |
|
686 | * @since 2.0 |
|
687 | */ |
|
688 | public static function insertAfterValue(array &$original, $value, $search, $isAssoc = false) |
|
689 | { |
|
690 | $key = array_search($search, $original); |
|
691 | ||
692 | if ($key === false) |
|
693 | { |
|
694 | throw new \InvalidArgumentException('Unknown value after which to insert the new value into the array.'); |
|
695 | } |
|
696 | ||
697 | return static::insertAfterKey($original, $value, $key, $isAssoc); |
|
698 | } |
|
699 | ||
700 | /** |
|
701 | * Insert value(s) into an array before a specific value (first found in array) |
|
@@ 713-723 (lines=11) @@ | ||
710 | * @throws \InvalidArgumentException |
|
711 | * @since 2.0 |
|
712 | */ |
|
713 | public static function insertBeforeValue(array &$original, $value, $search, $isAssoc = false) |
|
714 | { |
|
715 | $key = array_search($search, $original); |
|
716 | ||
717 | if ($key === false) |
|
718 | { |
|
719 | throw new \InvalidArgumentException('Unknown value before which to insert the new value into the array.'); |
|
720 | } |
|
721 | ||
722 | return static::insertBeforeKey($original, $value, $key, $isAssoc); |
|
723 | } |
|
724 | ||
725 | /** |
|
726 | * Sorts a multi-dimensional array by it's values. |