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 < $bday) ? -1 : 1);}
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;
HTH,
John W
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php