I'm a newbie to programming and PHP learning about two dimensional arrays.
When I run this code below, it just gives me a blank page. When I put an echo in front of the function call like this echo usort($a, 'mysort1');
the page shows me a 1 (I have no idea why).
What I really want to see is the output of the array after it's been sorted.
Doing var_dump($a);
is not what I'm after. how do I show the result of the function?
How? Thanks if you can help.
<?php
$a = array (
array ('key1' => 940, 'key2' => 'blah'),
array ('key1' => 23, 'key2' => 'this'),
array ('key1' => 894, 'key2' => 'that')
);
function mysort1($x, $x) {
return ($x['key1'] > $y['key']);
}
usort($a, 'mysort1');
?>