brendan6 Posted November 16, 2007 Share Posted November 16, 2007 Ive always know php to have non-strict, non-explicit variables. Is this correct or is there a smoother way of going about it? Quote Link to comment Share on other sites More sharing options...
hostfreak Posted November 16, 2007 Share Posted November 16, 2007 You can set the type: <a href="http://php.net/settype">Settype</a> Or cast it: <a href="http://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting">Type Casting</a> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 16, 2007 Share Posted November 16, 2007 also cranking up error reporting will get you a "stricter" version for say Quote Link to comment Share on other sites More sharing options...
obsidian Posted November 16, 2007 Share Posted November 16, 2007 Ive always know php to have non-strict, non-explicit variables. Is this correct or is there a smoother way of going about it? You are correct. PHP is very forgiving with data types. It does implicit type casting on comparisons, etc. This is the type of thing that can get you into trouble since (0 == FALSE) resolves to a true comparison. There is, however, the "===" comparison operator that compares both value and data type, so while (0 == FALSE) is true, (0 === FALSE) is not since one is an integer and one is a boolean. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.