(PHP 5 >= 5.4)
is_blank
— Determine whether a variable has a non-empty value.
boolean is_blank( mixed $var )
Alternative to empty()
that accepts non-empty values:
- 0 (0 as an integer)
- 0.0 (0 as a float)
- "0" (0 as a string)
var
— The value to be checked.
Returns FALSE
if var exists and has a non-empty value. Otherwise returns TRUE
.
$ composer require mcaskill/php-is-blank
Why are you not using composer? Download Function.Is-Blank.php
from the gist and save the file into your project path somewhere.