[ create a new paste ] login | about

Link: http://codepad.org/UMILqree    [ raw code | output | fork ]

PHP, pasted on Jun 27:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

$pets = array(
   'cat' => 'Lushy',
   'dog' => 'Fido',
   'fish' => 'Goldie' 
);
$order = array(
    'fish',
    'dog',
    'cat',
);

$sorted = array_merge(array_flip($order), $pets);

print_r($sorted);


Output:
1
2
3
4
5
6
Array
(
    [fish] => Goldie
    [dog] => Fido
    [cat] => Lushy
)


Create a new paste based on this one


Comments: