I have an array as so:
$animals = array ( \'giraffe\', \'lion\', \'hippo\', \'dog\', \'cat\', \'rabbit\', \'fly\', \'hamster\
You can splice the array for those to elements, randomize their order and put them back in the original array:
splice
$sub = array_splice($animals, 7, 2); shuffle($sub); array_splice($animals, 7,0, $sub); var_dump($animals);