Isset and empty if (isset ($ _ POST ["pageLimit"]) &! Empty ($ _ POST ["pageLimit"]) {
$ PageLimit = $ _ POST ["pageLimit"];
} Else {
$ PageLimit = 0;
}
Is the isset redundant,
Some people say
If the pagelimit field does not exist, an error is thrown when you use empty to determine whether the field exists,
Why can't I see the exception? do I still need to set php. ini?
Reply to discussion (solution)
You can set error_reporting to E_ALL.
You mean
If (! Empty ($ _ POST ["pageLimit"]) {
No exception?
Ini_set ('error _ report', E_ALL );
Now.
The biggest difference between empty and isset is that if empty is 0, true if (isset ($ _ POST ["pageLimit"]) is returned. &! Empty ($ _ POST ["pageLimit"]) {
$ PageLimit = $ _ POST ["pageLimit"];
} Else {
$ PageLimit = 0;
}
Is the isset redundant,
Some people say
If the pagelimit field does not exist, use empty to determine ......
You mean
If (! Empty ($ _ POST ["pageLimit"]) {
No exception?
Ini_set ('error _ report', E_ALL );
Now.
Ini_set ('error _ report', E_ALL );
If (empty ($ _ POST ["zz"]) {
Echo 1;
}
?>
It seems that no exception is thrown.
Ini_set ('error _ report', E_ALL );
Does not work? Then
Error_reporting (E_ALL );
Ini_set ('error _ report', E_ALL );
Does not work? Then
Error_reporting (E_ALL );
No changes,
You can test
Oh, it's changed. Earlier versions do not work.
If (isset ($ _ POST ["pageLimit"]) &! Empty ($ _ POST ["pageLimit"]) {
$ PageLimit = $ _ POST ["pageLimit"];
} Else {
$ PageLimit = 0;
}
According to your code, the previous one does not need to be written.
As mentioned above, empty (0) returns true, but your $ pageLimit = 0;, so isset can be removed completely.
When you learn a certain program, you will know the differences and advantages of the two.