|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-11-01 07:36 UTC] johannes@php.net
[2005-11-02 03:13 UTC] john dot clements at publicinfo dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 21:00:01 2025 UTC |
Description: ------------ This is a problem with === true and !== true whether used with strpos or with array_search and presumably with other functions. This also fails under PHP 4.3.10 on FreeBSD 4.8-STABLE, but that is a hosted server and I can't upgrade it to test. I have done further testing and found that checking for === false or !== false is OK: === false works when statement is true === false works when statement is false === true doesn't work when statement is true === true works when statement is false !== true doesn't work when statement is true !== true works when statement is false !== false works when statement is true !== false works when statement is false Pls get in touch if you would like the code to show that. Reproduce code: --------------- <?php if (strpos("hey","h") === true) print "1. worked \n"; else print "1. didn't work\n"; if (strpos("hey","h") !== false) print "2. worked \n"; else print "2. didn't work\n"; ?> Expected result: ---------------- 1. worked 2. worked Actual result: -------------- 1. didn't work 2. worked