php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #73967 PHP "not" logical operator
Submitted: 2017-01-20 20:39 UTC Modified: 2017-01-20 21:07 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: lauris at lauris dot lv Assigned:
Status: Wont fix Package: *General Issues
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lauris at lauris dot lv
New email:
PHP Version: OS:

 

 [2017-01-20 20:39 UTC] 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
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-20 21:04 UTC] stas@php.net
-Package: PHP Language Specification +Package: *General Issues
 [2017-01-20 21:07 UTC] nikic@php.net
-Status: Open +Status: Wont fix
 [2017-01-20 21:07 UTC] nikic@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 15:01:28 2024 UTC