tt25 (owner)

Revisions

gist: 46832 Download_button fork
public
Public Clone URL: git://gist.github.com/46832.git
Embed All Files: show embed
PHP #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
 
class A {
const CON="class A";
 
static function foo(){
var_dump(__CLASS__);
var_dump(self);
var_dump(self::CON);
var_dump(new self());
$c=__CLASS__;
var_dump(new $c());
var_dump(get_class(new self()));
}
}
 
class B extends A {
const CON="class B";
}
 
A::foo();
echo "\n----\n";
B::foo();
 
 
 
/*
C:\WINDOWS\system32\cmd.exe /c php test.php
string(1) "A"
string(4) "self"
string(7) "class A"
object(A)#1 (0) {
}
object(A)#1 (0) {
}
string(1) "A"
 
----
string(1) "A"
string(4) "self"
string(7) "class A"
object(A)#1 (0) {
}
object(A)#1 (0) {
}
string(1) "A"
Hit any key to close this window...
 
*/