Last active
December 15, 2015 11:29
-
-
Save tomsseisums/5253114 to your computer and use it in GitHub Desktop.
array_push_after
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_push_after(&$array, $key, array $value) | |
{ | |
$keys = array_keys($array); | |
$_keyPosition = array_search($key, $keys); | |
// TODO: Fix indexed value | |
$array = array_slice($array, 0, $_keyPosition + 1, true) + $value + array_slice($array, $_keyPosition, count($array) - $_keyPosition, true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment