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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 03:01:32 2025 UTC