[ create a new paste ] login | about

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

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

	$data = array (
	Array ( 'Points' => 500, 'Name' => 'Lerielle Cole' ) ,
	Array ( 'Points' => 1200, 'Name' => 'John Smith' ), 
	Array ( 'Points' => 700, 'Name' => 'Jason Smithsonian' ) );

	function cmp ($a, $b) {
	    return $a['Points'] < $b['Points'] ? 1 : -1;
	}

	usort($data, "cmp");
        
        print_r($data);


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Array
(
    [0] => Array
        (
            [Points] => 1200
            [Name] => John Smith
        )

    [1] => Array
        (
            [Points] => 700
            [Name] => Jason Smithsonian
        )

    [2] => Array
        (
            [Points] => 500
            [Name] => Lerielle Cole
        )

)


Create a new paste based on this one


Comments: