I want to display an error when a variable have a BLANK value or EMPTY or NULL value. for example variable is shown below:
$mo = strtotime($_POST['MondayOpen']);
and
var_dump($_POST['MondayOpen']) returns string(0) "".
Now I go with below approach
First want to find which type of variable
$mois ?(string or integer or other)Which function is better to find that
$mohaving no value.
I conduct a test with $mo and got these results
is_int($mo);//--Return nothing
is_string($mo); //--Return bool(false)
var_dump($mo); //--Return bool(true)
var_dump(empty($mo));//--Return bool(true)
var_dump($mo==NULL);//--Return bool(true)
var_dump($mo=='');//--Return nothing
Please suggest an optimum and right approach to check the variable integrity
==which tests for equality, such as1 == '1'which would evaluate totrue. But when you use===it tests if the types are equal. In my example1 === '1'will return false, sinceintis not aString.