note 128655 added to language.constants.magic
| From: | Rich at main dot php dot net | Date: | Mon, 03 Jul 2023 09:27:32 +0000 |
| Subject: | note 128655 added to language.constants.magic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220616@lists.php.net to get a copy of this message | ||
<?php
namespace My\App {
class Api {
public static fetch() {
print __FUNCTION__ . "\n"; // outputs fetch
print __METHOD__ . "\n"; // outputs My\App\Api::fetch
}
}
Api::fetch();
}
namespace {
My\App\Api::fetch();
}
?>
__METHOD__ outputs a fully qualified method name; __FUNCTION__ when used in a method, outputs just
the method name.
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.168 (proxied: 81.174.169.217)
----
Manual Page -- https://php.net/manual/en/language.constants.magic.php
Edit -- https://main.php.net/note/edit/128655
Del: integrated -- https://main.php.net/note/delete/128655/integrated
Del: useless -- https://main.php.net/note/delete/128655/useless
Del: bad code -- https://main.php.net/note/delete/128655/bad+code
Del: spam -- https://main.php.net/note/delete/128655/spam
Del: non-english -- https://main.php.net/note/delete/128655/non-english
Del: in docs -- https://main.php.net/note/delete/128655/in+docs
Del: other reasons-- https://main.php.net/note/delete/128655
Reject -- https://main.php.net/note/reject/128655
Search -- https://main.php.net/manage/user-notes.php