$ _POST ['val'] = 0未提交ajax时

I don't know why but in a PHP script the variable value is 0 when the post is not submitted to the page...

$use = isset( $_POST['use'] ) ? (int) $_POST['use'] : '';

No Ajax right now but the following if is always true:

// $use must be '' and '' != 0 or 1 right?
if ($use == 0 || $use == 1)

Isn't this the correct way of doing it? Why is the code between that if executing?

if ($use === 0 || $use === 1)

Will check the typing of the variable as well

http://php.net/manual/en/language.operators.comparison.php

With the loose comparison in this instance 0 can be false and '' can also be seen as false, and thus performing if('' == 0) is true