is_numeric() And is_int() in PHP

Both is_numeric() and is_int() will return neither TRUE nor FALSE, but null if parameter is null. Logically, it is correct. Practically, it does make these two functions next to useless. Because we human being would never believe null is numeric. For human being, it is obvious...

To make it useful, we would first consider if parameter is null or not, then if it is numeric. Here is simple way to test these three situations once for all:

if (0!=strlen(trim(@$para)) && is_numeric(@$para)) {...};

1 comment:

  1. I found a very basic LOGIN FORM at http://paidcritique.blogspot.com/2011/08/log-in-basic.html

    it says that it came from some seller of black scrubs, brown scrubs and gray scrubs from PulseUniform.

    ReplyDelete

Labels