Bug #78336 [Opn->Nab]: Error compare zero with array[n]

From: Date: Fri, 26 Jul 2019 16:13:35 +0000
Subject: Bug #78336 [Opn->Nab]: Error compare zero with array[n]
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221944@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78336&edit=1 ID: 78336 Updated by: requinix@php.net Reported by: lucastiagodemoraes at gmail dot com Summary: Error compare zero with array[n] -Status: Open +Status: Not a bug Type: Bug Package: Arrays related Operating System: Ubuntu 18.04 PHP Version: 7.2.20 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 https://www.php.net/manual/en/language.operators.comparison.php https://www.php.net/manual/en/language.types.type-juggling.php https://www.php.net/manual/en/types.comparisons.php Previous Comments: ------------------------------------------------------------------------ [2019-07-26 16:10:17] lucastiagodemoraes at gmail dot com Description: ------------ Hi guys, See example of bug you will understand. If this is normal in PHP is very strange. Thanks. Test script: --------------- <?php $letters = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'); print 0 == $letters[0] ? $letters[0] : 'false'; print 0 == $letters[1] ? $letters[1] : 'false'; print 0 == $letters[2] ? $letters[2] : 'false'; print 0 == $letters[3] ? $letters[3] : 'false'; print 0 == $letters[4] ? $letters[4] : 'false'; Expected result: ---------------- falsefalsefalsefalsefalse Actual result: -------------- abcde ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78336&edit=1

« previous php.bugs (#221944) next »