get_class()函数

今天介绍个函数,举例示之。

1
2
3
4
5
6
7
8
class A{
function __construct(){
echo "My name is " , get_class($this) , "\n";
}
}
class B extends A{
}
$b=new B();
//输出结果:My name is B
get_class 用在A和用在B中是一样的。比较好玩的特性,在此记录一下,以备后查!
2010年8月25日 | 归档于 LAMP
标签: PHP
  1. 2010年8月26日 10:18 | #1

    超人歇菜了。。呀哈哈~~

发表评论

XHTML: 您可以使用这些标签: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>