note 102594 deleted from control-structures.if by danbrown
| From: | danbrown@php.net | Date: | Wed, 23 Feb 2011 15:46:46 +0000 |
| Subject: | note 102594 deleted from control-structures.if by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177249@lists.php.net to get a copy of this message | ||
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