Re: Problem with usort
| From: | Stut | Date: | Thu, 04 May 2006 16:20:39 +0000 |
| Subject: | Re: Problem with usort | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235531@lists.php.net to get a copy of this message | ||
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 not, it sets $ret_val to 1. $ret_val = ($aday < $bday) ? -1 : 1; } return ret_val;I'm aware of that. I wasn't sure of the precedence between = and ?. Anyway, as someone else has pointed out, there is a missing $ on the return value. -Stut