View Full Version : php strpos
11-12-2006, 07: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, 07:58 PM
It does not. It returns a zero. You must test using the === FALSE (equavalant to) operator.
11-13-2006, 09: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.