Req #73967 [Opn->Wfx]: PHP "not" logical operator
| From: | nikic@php.net | Date: | Fri, 20 Jan 2017 21:07:11 +0000 |
| Subject: | Req #73967 [Opn->Wfx]: PHP "not" logical operator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206799@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73967&edit=1
ID: 73967
Updated by: nikic@php.net
Reported by: lauris at lauris dot lv
Summary: PHP "not" logical operator
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: *General Issues
Operating System: any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
and / or exist because they have lower precedence than && / ||, which was useful for certain
patterns like "$x = expr or die". The same does not apply to the unary not. Using and/or
in conditional expressions is highly unidiomatic in PHP.
Previous Comments:
------------------------------------------------------------------------
[2017-01-20 20:39:17] lauris at lauris dot lv
Description:
------------
PHP have logical operator pairs:
* && -> and
* || -> or
but no verbal equivalent of ! (not operator). I suggest to add equivalent to "!" (not
equals) as "not".
Test script:
---------------
<?php
if (!$valid)
{
// Error condition
}
Expected result:
----------------
<?php
if (not $valid)
{
// Error condition
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73967&edit=1