class DBNews {
public function get_latest_posts($limit){
// code goes here
$posts_array = array();
uasort($posts_array, $this->cmp);
}
public function cmp($a, $b) {
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
}
I get the following warning :
Warning: uasort() expects parameter 2 to be a valid callback,
no array or string given in
C:\xampp\htdocs
ews\admin\functions.php on line 554.
And the 554th line contains uasort($posts_array, $this->cmp).
Where to make use of the string or array and in what way?
EDIT : If I use uasort($posts_array, array($this, 'cmp'));, I get the following warning:
uasort() expects parameter 2 to be a valid callback,
array must have exactly two members in
C:\xampp\htdocs
ews\admin\functions.php on line 554