note 78407 added to functions.arguments
| From: | jbarnett at flowershopnetwork dot com | Date: | Wed, 10 Oct 2007 19:35:38 +0000 |
| Subject: | note 78407 added to functions.arguments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131279@lists.php.net to get a copy of this message | ||
The documentation says, "The default value must be a constant expression, not (for example) a
variable, a class member or a function call."
Class constants (and presumably global constants) can be used:
<?php
class Foo {
const BAR = "constant value";
public function myMethod($arg = self::BAR) {
echo $arg; // IT WORKS!
}
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 68.95.121.200
----
Manual Page -- http://www.php.net/manual/en/functions.arguments.php
Edit -- https://master.php.net/note/edit/78407
Del: integrated -- https://master.php.net/note/delete/78407/integrated
Del: useless -- https://master.php.net/note/delete/78407/useless
Del: bad code -- https://master.php.net/note/delete/78407/bad+code
Del: spam -- https://master.php.net/note/delete/78407/spam
Del: non-english -- https://master.php.net/note/delete/78407/non-english
Del: in docs -- https://master.php.net/note/delete/78407/in+docs
Del: other reasons-- https://master.php.net/note/delete/78407
Reject -- https://master.php.net/note/reject/78407
Search -- https://master.php.net/manage/user-notes.php