Posted by Oli Filth on 10/11/05 12:53
Erwin Moller said the following on 11/10/2005 10:05:
> Michael Jack wrote:
>
>
>>Hi,
>>
>>in the program below, what is the meaning/use of
>>the question mark (?gcd) and the colon (:$a) after the return statement?
>>Any explanation will be appreciated.
>
>
> Hi Michael,
>
> It is just a shorthand notation for an if-then-else statement
Not quite. You couldn't use it for something like:
if (6 == $a)
{
for ($i = 0; $i < $a; ++i)
{
...
}
}
else
{
// Some other code
}
It's really a conditional assignment operator.
--
Oli
[Back to original message]
|