Here's a simple example:
echo 3==3; // echoes 1
echo 3==2; // should echo 0, yet echoes nothing
I noticed this as I was designing a form which entails a checkbox. When ticked, the checkbox passes a value of 1, when unticked, rather than passing a value of 0 as one would expect, it passes nothing; an undefined boolean so to speak.
I tried solving this with the following code:
$myBool = isset($_POST['myCheckbox']);
However, this doesn't seem to work either.
One solution to passing the checkbox value to $myBool
would be to do some if-else conditioning, but I want a more concise solution. Is this possible?