On Dec 27, 4:04 pm, rojas....@gmail.com wrote:
> This function will allow you to check if a value is empty or NULL.,
> very useful on forms.
> --------------------------------------------------------------------------- ------------------------------------------------
> function checkEmpty($variable){
> if($variable == NULL || $variable == ''){
> $isempty = true;} else {
> $isempty = false;
> //End if
> }
> --------------------------------------------------------------------------- ----------------------------------------------
You forgot a return statement. Add <code>return $isempty;</code> after
you close the else block.
Because this function simply returns the value of a conditional test,
its possible to write this function with only one line in the function
body:
<pre>function checkEmpty($variable) {
return ($variable == NULL || $variable == '')
}</pre>