Skip to content

Instantly share code, notes, and snippets.

@tomsseisums
Last active December 15, 2015 11:29
Show Gist options
  • Save tomsseisums/5253114 to your computer and use it in GitHub Desktop.
Save tomsseisums/5253114 to your computer and use it in GitHub Desktop.
array_push_after
<?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