xref: /PHP-5.5/Zend/tests/lsb_020.phpt (revision feb85801)
1--TEST--
2ZE2 Late Static Binding properties and methods declared as public and overridden as public.
3--FILE--
4<?php
5class TestClass {
6	public static $staticVar;
7
8	public static function staticFunction() {
9		return 'TestClassFunction';
10	}
11
12	public static function testStaticVar() {
13		TestClass::$staticVar = 'TestClassStatic';
14		ChildClass1::$staticVar = 'ChildClassStatic';
15		return static::$staticVar;
16	}
17
18	public static function testStaticFunction() {
19		return static::staticFunction();
20	}
21}
22
23class ChildClass1 extends TestClass {
24	public static $staticVar;
25
26	public static function staticFunction() {
27		return 'ChildClassFunction';
28	}
29}
30
31class ChildClass2 extends TestClass {}
32
33echo TestClass::testStaticVar() . "\n";
34echo TestClass::testStaticFunction() . "\n";
35
36echo ChildClass1::testStaticVar() . "\n";
37echo ChildClass1::testStaticFunction() . "\n";
38
39echo ChildClass2::testStaticVar() . "\n";
40echo ChildClass2::testStaticFunction() . "\n";
41?>
42--EXPECTF--
43TestClassStatic
44TestClassFunction
45ChildClassStatic
46ChildClassFunction
47TestClassStatic
48TestClassFunction
49