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

What are the differences between php magic variables __METHOD__ and __FUNCTION__

WBOY
WBOYOriginal
2016-07-25 08:52:301155browse
  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



Statement:
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