note 112674 added to functions.arguments
| From: | a at 88k dot us | Date: | Thu, 11 Jul 2013 13:38:28 +0000 |
| Subject: | note 112674 added to functions.arguments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195574@lists.php.net to get a copy of this message | ||
An example using class constants as part of a function argument default value:
<?php
class Example {
const A = 1;
public function __construct($param = self::A) {}
}
$ex = new Example();
?>
Note: static will NOT work; PHP returns a fatal error: "static::" is not allowed in
compile-time constants.
----
Server IP: 69.147.83.199
Probable Submitter: 173.15.65.161
----
Manual Page -- http://php.net/manual/en/functions.arguments.php
Edit -- https://master.php.net/note/edit/112674
Del: integrated -- https://master.php.net/note/delete/112674/integrated
Del: useless -- https://master.php.net/note/delete/112674/useless
Del: bad code -- https://master.php.net/note/delete/112674/bad+code
Del: spam -- https://master.php.net/note/delete/112674/spam
Del: non-english -- https://master.php.net/note/delete/112674/non-english
Del: in docs -- https://master.php.net/note/delete/112674/in+docs
Del: other reasons-- https://master.php.net/note/delete/112674
Reject -- https://master.php.net/note/reject/112674
Search -- https://master.php.net/manage/user-notes.php