note 102809 added to function.constant
| From: | Anonymous at osu1 dot php dot net | Date: | Tue, 08 Mar 2011 02:59:43 +0000 |
| Subject: | note 102809 added to function.constant | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-177646@lists.php.net to get a copy of this message | ||
You can get the value of class and interface constants using this function.
<?php
interface IDatabase {
const Test = 22;
}
class MyDatabase implements IDatabase {
}
echo constant('MyDatabase::Test'); # Outputs 22
echo constant('IDatabase::Test'); # Also outputs 22
?>
----
Server IP: 192.41.42.26
Probable Submitter: 76.25.105.79
----
Manual Page -- http://www.php.net/manual/en/function.constant.php
Edit -- https://master.php.net/note/edit/102809
Del: integrated -- https://master.php.net/note/delete/102809/integrated
Del: useless -- https://master.php.net/note/delete/102809/useless
Del: bad code -- https://master.php.net/note/delete/102809/bad+code
Del: spam -- https://master.php.net/note/delete/102809/spam
Del: non-english -- https://master.php.net/note/delete/102809/non-english
Del: in docs -- https://master.php.net/note/delete/102809/in+docs
Del: other reasons-- https://master.php.net/note/delete/102809
Reject -- https://master.php.net/note/reject/102809
Search -- https://master.php.net/manage/user-notes.php