View Full Version : php strpos
11-12-2006, 06:42 PM
when checking for the presence of a string using strpos, why does it return false if the string's at position 0?
11-12-2006, 06:58 PM
It does not. It returns a zero. You must test using the === FALSE (equavalant to) operator.
11-13-2006, 08:59 AM
in PHP, 0 evaluates to false, but retains it's type. So 0 == false is true but 0 === false is not. === is a type-strict value comparison.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.