<?php
//定义函数
function outFunction()
{
echo '__METHOD__ =>'.__METHOD__;
echo '<br>';
echo '__FUNCTION__ =>'.__FUNCTION__;
}
//定义类
class Test
{
static function gongwen()
{
echo '__METHOD__ =>'.__METHOD__;
echo '<br>';
echo '__FUNCTION__ =>'.__FUNCTION__;
}
static function bestphper()
{
function innerFunction()
{
echo '__METHOD__ =>'.__METHOD__;
echo '<br>';
echo '__FUNCTION__ =>'.__FUNCTION__;
}
innerFunction();
}
}
//测试
Test::gongwen();
echo '<hr>';
Test::bestphper();
echo '<hr>';
outFunction();
?>
结果:
838251-20151124142357531-98830456.jpg
结论:
- 情况一:
FUNCTION与METHOD 同处于“类外”的函数体中,他们的返回值是一样一样滴.
- 情况二:
FUNCTION与METHOD 同处于“类内”的函数体中,METHOD 比 FUNCTION前面多了个“类名::”