3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { function example() { echo "I am the original function A::example().<br />\n"; } } class B extends A { function example() { echo "I am the redefined function B::example().<br />\n"; A::example(); } } // there is no object of class A. // this will print // I am the original function A::example().<br /> A::example(); // create an object of class B. $b = new B; // this will print // I am the redefined function B::example().<br /> // I am the original function A::example().<br /> $b->example();
Output for 7.0.0 - 7.1.0
Deprecated: Non-static method A::example() should not be called statically in /in/CPSrO on line 18 I am the original function A::example().<br /> I am the redefined function B::example().<br /> I am the original function A::example().<br />
Output for 4.3.0 - 4.4.9, hhvm-3.10.0 - 3.12.0
I am the original function A::example().<br /> I am the redefined function B::example().<br /> I am the original function A::example().<br />
Output for 5.0.0 - 5.6.28
Strict Standards: Non-static method A::example() should not be called statically in /in/CPSrO on line 18 I am the original function A::example().<br /> I am the redefined function B::example().<br /> I am the original function A::example().<br />