PHP Array Reorder

In one of my projects I had to re-order an array, placing an existing key-value to someplace else with an user specified integer. The thing about PHP’s many native functions, they all have different consequences and outcomes to each native function; preserve keys, ordering, sort by.. so on. For this task, I had keep the keys and move an value whilst keeping the rest of the array keys & values untouched, pretty much like shifting an array at any point. This StackOverFlow User ‘Dereleased‘ provided just the ticket:

<br />
/**<br />
 *  Re-Order it..<br />
 *<br />
 *      Example:<br />
 *<br />
 *      @Use: array_reorder( array, 3, 1 );<br />
 *<br />
 *          array(<br />
 *              1 =&gt; a,<br />
 *              2 =&gt; b,<br />
 *              3 =&gt; c )<br />
 *<br />
 *      Returns:<br />
 *<br />
 *           array(<br />
 *              1 =&gt; c,<br />
 *              2 =&gt; b,<br />
 *              3 =&gt; a )<br />
 *<br />
**/<br />
private function array_reorder($array, $oldIndex, $newIndex) {<br />
    array_splice(<br />
        $array,<br />
        $newIndex,<br />
        count($array),<br />
        array_merge(<br />
            array_splice($array, $oldIndex, 1),<br />
            array_slice($array, $newIndex, count($array))<br />
        )<br />
    );<br />
    return $array;<br />
}<br />