input
input

Reputation: 7519

Function from ASP to PHP

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 function invalidParam($response) {

}

Upvotes: 0

Views: 186

Answers (2)

cstruter
cstruter

Reputation: 1107

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

Upvotes: 2

Chandu
Chandu

Reputation: 82893

You can use the inbuilt function empty in php for this. Link: http://php.net/manual/en/function.empty.php

Upvotes: 2

Related Questions