note 102594 deleted from control-structures.if by danbrown
[email protected] Wed, 23 Feb 2011 07:46:46 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
Note Submitter: adam dot pilorz at labsql dot pl
----
Donny Nyamweya,
You weren't actually precise when writing "(condition ? action_if_true: action_if_false;)". It's rather "(condition ? VALUE_if_true : VALUE_if_false)" in statement such as
<?php
$text = ( $a > $b ? 'a is bigger then b' : 'b is bigger or equal to a' );
echo $text;
?>
Note, that 'a is bigger then b' and 'b is bigger or equal to a' are values (strings), not actions. For example
<?php
( 1 > 0 ? echo('ok') : echo('no') );
?>
Would just not work