List Info

Thread: note 66870 added to language.oop5.constants




note 66870 added to language.oop5.constants
user name
2006-05-31 09:03:36
In addition to what "tobias_demuth at web dot
de" wrote:

Assigning the return value of a function to a constant does
not work. Thus you may assign the return value of a function
to a global constant defintion using "define()"
and assign this global constant to the class constant.

The following example works as expected.

<?php

define("MYTIME", time());

class test {
     const time = MYTIME;
}

print test::time;

?>

Will output the current timestamp. Whatsoever: IMHO this is
"bad style" and so I suggest NOT to use this as
"workaround".
----
Server IP: 66.163.161.117
Probable Submitter: 213.238.41.61 (proxied: 192.168.168.42)
----
X-Spam-Status: No, hits=3.1 required=5.0
tests=DATE_MISSING,FROM_NO_LOWER 
	autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.oop5.constants.php

Edit        -- http://master.p
hp.net/note/edit/66870
Del: integrated  -- ht
tp://master.php.net/note/delete/66870/integrated
Del: useless     -- http:
//master.php.net/note/delete/66870/useless
Del: bad code    -- http
://master.php.net/note/delete/66870/bad+code
Del: spam        -- http://m
aster.php.net/note/delete/66870/spam
Del: non-english -- h
ttp://master.php.net/note/delete/66870/non-english
Del: in docs     -- http:
//master.php.net/note/delete/66870/in+docs
Del: other reasons-- http://master
.php.net/note/delete/66870
Reject      -- http://master
.php.net/note/reject/66870
Search      -- http://ma
ster.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 )