<?php
$dataPoints = array(
array('1' => '33','2' => 'dave','3' => '367'),
array('1' => '168','2' => 'susan','3' => '56788'),
array('1' => '99','2' => 'tim','3' => '6')
);
usort($dataPoints, function cmp($a, $b){
if ($a[3] == $b[3]) {
return 0;
}
return ($a[3] < $b[3]) ? -1 : 1;
});
print_r($dataPoints[0]);
- Output for 5.4.20
- Parse error: syntax error, unexpected 'cmp' (T_STRING), expecting '(' in /in/NSSfg on line 10
Process exited with code 255. - Output for 5.4.0 - 5.4.19
- Parse error: syntax error, unexpected 'cmp' (T_STRING), expecting '(' in /in/aJnkq on line 10
Process exited with code 255. - Output for 5.3.0 - 5.3.27
- Parse error: syntax error, unexpected T_STRING, expecting '(' in /in/aJnkq on line 10
Process exited with code 255.
preferences:
193.82 ms | 1395 KiB | 56 Q