note 40627 deleted from functions.arguments by tomsommer

From: Date: Sun, 27 Jun 2004 02:14:11 +0000
Subject: note 40627 deleted from functions.arguments by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71848@lists.php.net to get a copy of this message
Note Submitter: kieran@kieran.ca ---- I was trying to pass an internal class variable as a default for a function argument inside the class where... um.... let me clarify with code: <? class some_class{ var $some_variable; function some_function($argument=$this->some_variable){ do the thing... } } ?> doesn't work, throws a parse error. Instead, I had to use: <? class some_class{ var $some_variable; function some_function($argument=''){ if(!$argument){$argument = $this->some_variable;} do the thing... } } ?> So much easier to explain by example! Hope that helps someone ;-) Cheers, Kieran

« previous php.notes (#71848) next »