ilhan
ilhan

Reputation: 8965

What to do if the parameter of a function is not defined? (PHP)

I have static function getQuery(isset($var)?$var:$var="no") which does not work.

I want to use it either by DoDb::getQuery(); or DoDb::getQuery($var); depending on the necessities.

Upvotes: 1

Views: 66

Answers (2)

John Smith
John Smith

Reputation: 808

Look at this page http://tuxradar.com/practicalphp/4/15/5. This is the same in many language ;)

Upvotes: 2

Dogbert
Dogbert

Reputation: 222238

static function getQuery($var="no")

Upvotes: 7

Related Questions