I need to sort an array, I've done this before but it has been easy because the array had numbers or letters to sort in ascedning/descending or alphabetical order.. In this case i have an array of which each element has 3 values, eg:

```
array[0]=code=1234
        =description='example array'
        =orderCode=P

array[1]=code=1235
        =description='example array1'
        =orderCode=A
.
.
.

```

Now i need to order theese reading the orderCode value in this order: P,I,B,C,A,S,D.
The way i thought of getting arround it was to add another value to the array and to something like:

```
if($array[$c]['orderCode'] == 'P')
     $array[$c]['newOrderCode'] = 0;
if($array[$c]['orderCode'] == 'I')
     $array[$c]['newOrderCode'] = 1;
if($array[$c]['orderCode'] == 'B')
     $array[$c]['newOrderCode'] = 2;

```

or a switch case and then order it by the new value. This would work, but my question is, is there a function I can pass the array to and an orderring string or something?

Thank you,
James