Are string values 0 and 1 in an array the same as true / false?

LPH

Well-known member
This may seem like a silly question but something happened in the latest updates for WordPress and Redux Framework. For years, I've used $options['something'] == true and it stopped working. Now, the code must be $options['something'] == '1' in order to do as expected. A var_dump shows string instead of int and thus the question: are string values 0 and 1 in an array the same as true / false? I'm trying to figure out why the code is now failing when using true or false.
 
It turns out the use of strict comparisons is the issue.

“1” == true [ Correct. ]
“1” === true [ Incorrect. ]

Even though my question showed loose, the code was using strict.
 
Top Bottom