While reviewing a pull request, I noticed my colleague is using a lot of truthy checks in the following manner:
if ($var === 1)
This doesn't work as expected for one condition in particular:
if(!empty($myArr) === 1) { } //
I know this won't work as expected in javascript, upon consulting php documentation, I am not 100% sure if this would work properly in PHP either.
My question is, would this work OK in PHP? Which one is a better way of checking for comparisons?
true
or 1
Using php 7.2