php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71016 Documentation issue regarding the "or" logical operator
Submitted: 2015-12-03 13:20 UTC Modified: 2015-12-18 19:25 UTC
From: henrywright at gmail dot com Assigned: tpunt (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Linux
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: henrywright at gmail dot com
New email:
PHP Version: OS:

 

 [2015-12-03 13:20 UTC] henrywright at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/language.operators.logical
---

The snippet below is taken directly from the manual page above. The comment mentions that true is ignored but I believe that isn't quite true. Granted true doesn't effect the value of $f, but I believe it has an effect on the entire expression overall.

Snippet from manual:

// The constant false is assigned to $f and then true is ignored
// Acts like: (($f = false) or true)
$f = false or true;


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-03 22:37 UTC] requinix@php.net
That's correct, the true is still "evaluated". Being a literal value, when it gets evaluated nothing happens, so in that sense it is ignored (it has no effect on anything). It could also be that the docs mean that true is ignored as far as $f is concerned (as in it has no effect on $f).

If you have a suggestion for how to improve the wording, click the Edit link in the top-right corner of the manual page, log in or stay anonymous, then make and submit a patch to the documentation.
 [2015-12-18 19:23 UTC] tpunt@php.net
Automatic comment from SVN on behalf of tpunt
Revision: http://svn.php.net/viewvc/?view=revision&revision=338305
Log: Resolve doc bug #71016
 [2015-12-18 19:23 UTC] tpunt@php.net
-Assigned To: +Assigned To: tpunt
 [2015-12-18 19:25 UTC] tpunt@php.net
Given that the right operand of "or" (as well as "and") is not technically ignored (since they become the return value for the overall expression), I've reworded it with the following commit: https://svn.php.net/viewvc?view=revision&revision=338305
 [2015-12-18 19:25 UTC] tpunt@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 01:00:02 2026 UTC