You are here: Re: [PHP] if then else short form « PHP « IT news, forums, messages
Re: [PHP] if then else short form

Posted by Richard Davey on 01/21/05 14:10

Hello Ben,

Friday, January 21, 2005, 12:01:09 PM, you wrote:

BE> I seem to remember seing someone use a abreaviated form of a
BE> if/them/else of the type that can be used in java.

BE> It was something like

BE> if ( a=b ) ? a=1 ; a=2;

BE> Anybody know what the correct syntax is?

It's called a ternary operator.

$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];

In the PHP manual under Comparison Operators.

Best regards,

Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde

 

Navigation:

[Reply to this 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

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