Doc #74115 [Opn->Nab]: and/or documented to be bool but int and/or int is int

From: Date: Fri, 17 Feb 2017 08:44:05 +0000
Subject: Doc #74115 [Opn->Nab]: and/or documented to be bool but int and/or int is int
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14445@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74115&edit=1 ID: 74115 Updated by: requinix@php.net Reported by: nick at lampnick dot com -Summary: This doc has some error descriptions. +Summary: and/or documented to be bool but int and/or int is int -Status: Open +Status: Not a bug Type: Documentation Problem -Package: Documentation problem +Package: Variables related Operating System: windows 7 PHP Version: 5.6.30 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php http://php.net/manual/en/language.operators.precedence.php = has higher precedence than and/or. https://3v4l.org/oTgLQ https://3v4l.org/2J1kI Previous Comments: ------------------------------------------------------------------------ [2017-02-17 03:36:47] nick at lampnick dot com Description: ------------ --- From manual page: http://php.net/manual/en/language.operators.logical.php --- $a and $b And TRUE if both $a and $b are TRUE. $a or $b Or TRUE if either $a or $b is TRUE. The 'and' and the 'or' is use for bits,but this doc use for Logical. Test script: --------------- <?php $a = 4; $b = 1; $res1 = $a and $b; $res2 = $a & $b; $res3 = $a or $b; $res4 = $a | $b; var_dump($res1);//the res1 is 4,but the manual describes the result to be a bool type. var_dump($res2); var_dump($res3); var_dump($res4); Expected result: ---------------- $a & $b And Bits that are set in both $a and $b are set. $a | $b Or (inclusive or) Bits that are set in either $a or $b are set. Actual result: -------------- $a and $b And TRUE if both $a and $b are TRUE. $a or $b Or TRUE if either $a or $b is TRUE. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74115&edit=1

« previous php.doc.bugs (#14445) next »