Re: [PHP] Problem with usort

2006-05-04 Thread Jon Earle
Rabin Vincent wrote: > You're missing the $ for ret_val on the return line. Clue-by-four to the head accepted. Thank you, it works well, now that it's written properly. Cheers! Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Problem with usort

2006-05-04 Thread Martin Alterisio \"El Hombre Gris\"
Rabin Vincent escribió: On 5/4/06, Jon Earle <[EMAIL PROTECTED]> wrote: $ret_val = 0; if ($aday == $bday) {$ret_val = 0;} else {$ret_val = ($aday < $bday) ? -1 : 1;} return ret_val; You're missing the $ for ret_val on the return line. PHP thus understands the return value as a string,

Re: [PHP] Problem with usort

2006-05-04 Thread John Wells
On 5/4/06, Stut <[EMAIL PROTECTED]> wrote: Anyway, as someone else has pointed out, there is a missing $ on the return value. -Stut Yup, missed that one too. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Problem with usort

2006-05-04 Thread Stut
John Wells wrote: Not true actually, it's a quick "if/else" using the ternary operator. It's also difficult to read all on one line: $ret_val = 0; if ($aday == $bday) { $ret_val = 0; } else { // what this does is test if $aday is less than $bday. // If so, it sets $ret_val to -1. If

Re: [PHP] Problem with usort

2006-05-04 Thread John Wells
On 5/4/06, Stut <[EMAIL PROTECTED]> wrote: Jon Earle wrote: > $ret_val = 0; > if ($aday == $bday) {$ret_val = 0;} > else {$ret_val = ($aday < $bday) ? -1 : 1;} > return ret_val; > > I could be wrong, but I think you need some extra brackets on the else line... else {$ret_val = (($aday < $b

Re: [PHP] Problem with usort

2006-05-04 Thread Rabin Vincent
On 5/4/06, Jon Earle <[EMAIL PROTECTED]> wrote: $ret_val = 0; if ($aday == $bday) {$ret_val = 0;} else {$ret_val = ($aday < $bday) ? -1 : 1;} return ret_val; You're missing the $ for ret_val on the return line. PHP thus understands the return value as a string, "ret_val", which would b

Re: [PHP] Problem with usort

2006-05-04 Thread Stut
Jon Earle wrote: $ret_val = 0; if ($aday == $bday) {$ret_val = 0;} else {$ret_val = ($aday < $bday) ? -1 : 1;} return ret_val; I could be wrong, but I think you need some extra brackets on the else line... else {$ret_val = (($aday < $bday) ? -1 : 1);} -Stut -- PHP General Mailing L