note 102594 added to control-structures.if
| From: | adam dot pilorz at labsql dot pl | Date: | Wed, 23 Feb 2011 13:41:42 +0000 |
| Subject: | note 102594 added to control-structures.if | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-177248@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.197
Probable Submitter: 77.253.221.74
----
Manual Page -- http://www.php.net/manual/en/control-structures.if.php
Edit -- https://master.php.net/note/edit/102594
Del: integrated -- https://master.php.net/note/delete/102594/integrated
Del: useless -- https://master.php.net/note/delete/102594/useless
Del: bad code -- https://master.php.net/note/delete/102594/bad+code
Del: spam -- https://master.php.net/note/delete/102594/spam
Del: non-english -- https://master.php.net/note/delete/102594/non-english
Del: in docs -- https://master.php.net/note/delete/102594/in+docs
Del: other reasons-- https://master.php.net/note/delete/102594
Reject -- https://master.php.net/note/reject/102594
Search -- https://master.php.net/manage/user-notes.php