Jump to content

Explicit/Strict PHP


brendan6

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.