List Info

Thread: note 78407 added to functions.arguments




note 78407 added to functions.arguments
user name
2007-10-10 14:35:38
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  -- h
ttps://master.php.net/note/delete/78407/integrated
Del: useless     -- http
s://master.php.net/note/delete/78407/useless
Del: bad code    -- htt
ps://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     -- http
s://master.php.net/note/delete/78407/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78407
Reject      -- https://mast
er.php.net/note/reject/78407
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )