I'm trying to convert the following function from ASP to PHP:
Function InvalidParam(response)
InvalidParam = IsEmpty(response) Or response = ""
End Function
I am not sure how to reference the function name inside the function in PHP as has been done in ASP.
public fun开发者_如何学Goction invalidParam($response) {
}
Something like this:
public function invalidParam($response) {
return empty($response);
}
But you can just as well use the empty function by itself
The following things are considered to be empty:
"" (an empty string)
0 (0 as an integer)
"0" (0 as a string)
NULL
FALSE
array() (an empty array)
var $var; (a variable declared, but without a value in a class)
http://www.php.net/manual/en/function.empty.php
You can use the inbuilt function empty in php for this. Link: http://php.net/manual/en/function.empty.php
精彩评论