note 109225 added to overload.examples.basic
| From: | Tas | Date: | Wed, 27 Jun 2012 15:33:34 +0000 |
| Subject: | note 109225 added to overload.examples.basic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188918@lists.php.net to get a copy of this message | ||
RE: Anonymous 26-Jun-2011 01:20
I think you mean:
class Foo{
public function method_noargs(){
echo "call Method no paramater";
}
public function method(){
if ( !count(func_get_args()) )
return $this->method_noargs(); //or in same method, doesnt matter
echo "call Method has paramater";
}
}
$foo = new Foo();
echo $foo->method();
Which (a) actually achieves the result and (b) will work even when you pass 0, false or null.
----
Server IP: 69.147.83.197
Probable Submitter: 87.194.188.74
----
Manual Page -- http://www.php.net/manual/en/overload.examples.basic.php
Edit -- https://master.php.net/note/edit/109225
Del: integrated -- https://master.php.net/note/delete/109225/integrated
Del: useless -- https://master.php.net/note/delete/109225/useless
Del: bad code -- https://master.php.net/note/delete/109225/bad+code
Del: spam -- https://master.php.net/note/delete/109225/spam
Del: non-english -- https://master.php.net/note/delete/109225/non-english
Del: in docs -- https://master.php.net/note/delete/109225/in+docs
Del: other reasons-- https://master.php.net/note/delete/109225
Reject -- https://master.php.net/note/reject/109225
Search -- https://master.php.net/manage/user-notes.php