Hi all,
I want to instantiate a class but only pass $var3 if it is actually set.
$result = $class->_method($var1, $var2, $var3);
What is the most efficient way to do this? Is there a way to do this check within the method call brackets?
i.e. something like:
$result = $class->_method($var1, $var2 (if(!empty($var3){"," . $var3}));
I obviously need to include the comma before $var3 if it isn't empty.
Thanks in advance!