Skip to main content
1 of 3

PHP method class variable

is it possible set method variable default value if variable is expected to be "new class"

class controller{

function getData(client $client){ } 

}

$c = new controller; $c->getData( new client );

TO SET DEFAULT VALUE LIKE

class controller{

function getData(client $client = new client){ } 

}

$c = new controller; $c->getData();