Posted by Erwin Moller on 10/11/05 14:21
Oli Filth wrote:
> 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.
True.
:-)
Regards,
Erwin Moller
[Back to original message]
|