Don't do that. :-)
For starters, sorting in PHP is MUCH less efficient than in a DB.
Secondly, getting multi-dimensional (sic) arrays in PHP to sort like
you want generates a ton of traffic here, so it must be hard. :-)
You can do somethig like this:
(SELECT x, y, z FROM real_data
SELECT 'manually', 'inserted', 'data' as z
ORDER BY z
And achieve MUCH better results with far less headache.
If 'z' is indexed in real_data, add another ORDER BY z right before
the UNION -- That will probably make it very fast/easy for the DB to
splice in your manually-inserted 'z' value.
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
Yeah, I get a buck. So?