I have an array:
array( 0 => \'contact\', 1 => \'home\', 2 => \'projects\' );
and I need to swap the \'contact\' with
$x = array('a', 'b', 'c', 'd'); array_splice($x, 1, 2, array_reverse(array_slice($x, 1, 2))); var_dump($x);
array_splice can replace a reversed array_slice