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
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,
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
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
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
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
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
7 matches
Mail list logo