note 77269 added to function.echo

From: Date: Wed, 22 Aug 2007 06:25:24 +0000
Subject: note 77269 added to function.echo
Groups: php.notes 
Request: Send a blank email to php-notes+get-129692@lists.php.net to get a copy of this message
You mentioned: <?php // Because echo does not behave like a function, the following code is invalid. ($some_var) ? echo 'true' : echo 'false'; ?> However, if you still want to echo a string, or anything else, you can use: <?php // This ternary operation will work because you can echo a bool true/false and vice-vursa echo ($some_var) ? 'true' : 'false'; ?> Hope this helps for someone who doesn't understand this very well :) ---- Server IP: 208.69.120.35 Probable Submitter: 69.179.222.251 ---- Manual Page -- http://www.php.net/manual/en/function.echo.php Edit -- https://master.php.net/note/edit/77269 Del: integrated -- https://master.php.net/note/delete/77269/integrated Del: useless -- https://master.php.net/note/delete/77269/useless Del: bad code -- https://master.php.net/note/delete/77269/bad+code Del: spam -- https://master.php.net/note/delete/77269/spam Del: non-english -- https://master.php.net/note/delete/77269/non-english Del: in docs -- https://master.php.net/note/delete/77269/in+docs Del: other reasons-- https://master.php.net/note/delete/77269 Reject -- https://master.php.net/note/reject/77269 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129692) next »