note 126244 added to function.echo
| From: | t3tesla at gmail dot com | Date: | Thu, 15 Jul 2021 22:43:13 +0000 |
| Subject: | note 126244 added to function.echo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216607@lists.php.net to get a copy of this message | ||
We can use the 'echo' shortcut syntax with the conditional operator (expr1) ? (expr2) :
(expr3)
<?php
$some_var = 10;
?>
Back to html :
<p class="<?=$some_var>5 ? "class1" : "class2"?>">Some
text.</p>
Will give : <p class="class1">Some text.</p>
<?php
$some_var = 4;
?>
<p class="<?=$some_var>5 ? "class1" : "class2"?>">Some
text.</p>
Will give : <p class="class2">Some text.</p>
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 2a01:cb00:9c7:2200:e8e8:4440:ba97:7b8c)
----
Manual Page -- https://php.net/manual/en/function.echo.php
Edit -- https://main.php.net/note/edit/126244
Del: integrated -- https://main.php.net/note/delete/126244/integrated
Del: useless -- https://main.php.net/note/delete/126244/useless
Del: bad code -- https://main.php.net/note/delete/126244/bad+code
Del: spam -- https://main.php.net/note/delete/126244/spam
Del: non-english -- https://main.php.net/note/delete/126244/non-english
Del: in docs -- https://main.php.net/note/delete/126244/in+docs
Del: other reasons-- https://main.php.net/note/delete/126244
Reject -- https://main.php.net/note/reject/126244
Search -- https://main.php.net/manage/user-notes.php