array index ordering

Lets say we have an array:


echo $array[1]; // orange

Now, lets say we want to insert "grape", between apples and orange. How do we do that?

I have some memory of seeing a php shortcut to do this, but I can't find it now.

Also, I see there are a number of custom php functions for sorting (kudos on some of these). Is there a way to write your own sorting function?