Reputation: 180
I am having difficulty understanding the proper syntax for the second default value in the following method declaration statement. Any suggestions would be greatly appreciated. Thanks!
protected function load($columName = self::_tableIdName, $columnValue = self::_data->{self::_tableIdName})
{...}
Notes: $_tableIdName
is a protected variable within the class;
$_data
is a protected stdClass object within the class.
I am trying to make the default for $columnValue
equal to the corresponding value from the internal $_data
object.
Upvotes: 0
Views: 492
Reputation: 53871
Just set the defaults to null, then check for null in the function body. You are limited to using constants in the argument intializer.
Upvotes: 5