개발관련/PHP
[PHP]Static Modifier
파노카페
2012. 4. 20. 15:37
total_students; echo Student::$total_students ."0
"; echo Student::welcome_students() ."
"; echo Student::welcome_students("Greetings") ."
"; Student::$total_students = 1; echo Student::$total_students ."
"; // static variables are shared throughout the inheritance tree. class One { static $foo; } class Two extends One { } class Three extends One { } One::$foo = 1; Two::$foo = 2; Three::$foo = 3; echo One::$foo; // 3 echo Two::$foo; // 3 echo Three::$foo; // 3 ?>
Hello students.
Greetings students.
1
333