Home > Backend Development > PHP Tutorial > What are the differences between php magic variables __METHOD__ and __FUNCTION__

What are the differences between php magic variables __METHOD__ and __FUNCTION__

WBOY
Release: 2016-07-25 08:52:30
Original
1230 people have browsed it
  1. class Test{
  2. public function doit(){
  3. echo __FUNCTION__;
  4. }
  5. public function doitAgain(){
  6. echo __METHOD__;
  7. }
  8. }
  9. $obj = new Test();
  10. $obj->doit();
  11. echo '
    ';
  12. $obj->doitAgain();
  13. ?>
Copy the code

Output result: doit Test::doitAgain



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template