note 110540 deleted from language.operators.logical by aharvey
| From: | aharvey@php.net | Date: | Mon, 05 Nov 2012 03:09:08 +0000 |
| Subject: | note 110540 deleted from language.operators.logical by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191664@lists.php.net to get a copy of this message | ||
Note Submitter: qeremy [atta] gmail [dotta] com
----
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!");
?>