You are here: Re: please explain or refer: $string = isset($xyz) ? $xyz : "something else"; « PHP Programming Language « IT news, forums, messages
Re: please explain or refer: $string = isset($xyz) ? $xyz : "something else";

Posted by Bert Melis on 05/10/05 23:02

juglesh wrote:
> "$string = isset($xyz) ? $xyz : "something else";"
>
>
> Hello, someone gave code like this in another thread. I understand (by
>
> inference) what it does, but have not found any documentation on this
> type of syntax.
>
>
> Any one have links to this shortuct(?) syntax and other types of
> syntax?
>
>
> thanks
> j
>

Look here:

http://www.php.net/manual/en/language.expressions.php

and search for "ternary conditional operator"

$first ? $second : $third

$first is evaluated, and if true, $second is the result. otherwise
$third is the result.

To store the result in a var:
$result = ($first) ? $second : $third

 

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

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