Reply to Re: How to use ? and : in a program

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация