note 110540 added to language.operators.logical
| From: | qeremy | Date: | Sat, 03 Nov 2012 23:09:09 +0000 |
| Subject: | note 110540 added to language.operators.logical | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191649@lists.php.net to get a copy of this message | ||
In my opinion, PHP needs a more specific operator instead of "!" sign for readability of
code for some situations.
So, wich is more readable?
<?php
// id could be
$id = 0;
$id = "";
$id = null;
$id = false;
// not sign
if (!$id) die("No id provided!");
// my not idea
if (not $id) die("No id provided!");
// I don't mean this
if ($id !== 0) ...
if ($id not == 0) ...
// but maybe this, ahh forget it
if ($id not 0) ...
// I use this for it but I think it's not suitable than a structure keyword
function not($value) {
return !$value;
}
if (not($id)) die("No id provided!");
if (not $id) die("No id provided!");
?>
----
Server IP: 69.147.83.199
Probable Submitter: 78.173.125.108
----
Manual Page -- http://www.php.net/manual/en/language.operators.logical.php
Edit -- https://master.php.net/note/edit/110540
Del: integrated -- https://master.php.net/note/delete/110540/integrated
Del: useless -- https://master.php.net/note/delete/110540/useless
Del: bad code -- https://master.php.net/note/delete/110540/bad+code
Del: spam -- https://master.php.net/note/delete/110540/spam
Del: non-english -- https://master.php.net/note/delete/110540/non-english
Del: in docs -- https://master.php.net/note/delete/110540/in+docs
Del: other reasons-- https://master.php.net/note/delete/110540
Reject -- https://master.php.net/note/reject/110540
Search -- https://master.php.net/manage/user-notes.php