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? Link to comment https://forums.phpfreaks.com/topic/77628-explicitstrict-php/ 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> Link to comment https://forums.phpfreaks.com/topic/77628-explicitstrict-php/#findComment-392933 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 Link to comment https://forums.phpfreaks.com/topic/77628-explicitstrict-php/#findComment-392941 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. Link to comment https://forums.phpfreaks.com/topic/77628-explicitstrict-php/#findComment-392944 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.