3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait TaxTools { function calculateтax ( $price ) { return self::prop . $price ; } } abstract class Alert{ const prop = 'value__'; abstract function limpopo(); } class Alert2 extends Alert{ use TaxTools; public function limpopo(){ // return self::$foo; return self::foo; } } $obj = new Alert2; echo $obj->calculateтax(8); //value__8 echo '<br>'; echo $obj::calculateтax(8); //value__8 echo '<br>'; echo $obj::limpopo(); //Fatal error: Undefined class constant 'foo'
Output for 7.0.0 - 7.2.0
value__8<br> Deprecated: Non-static method Alert2::calculateтax() should not be called statically in /in/Gg10q on line 28 value__8<br> Deprecated: Non-static method Alert2::limpopo() should not be called statically in /in/Gg10q on line 31 Fatal error: Uncaught Error: Undefined class constant 'foo' in /in/Gg10q:18 Stack trace: #0 /in/Gg10q(31): Alert2::limpopo() #1 {main} thrown in /in/Gg10q on line 18
Process exited with code 255.
Output for 5.4.9 - 5.6.28
value__8<br> Strict Standards: Non-static method Alert2::calculateтax() should not be called statically in /in/Gg10q on line 28 value__8<br> Strict Standards: Non-static method Alert2::limpopo() should not be called statically in /in/Gg10q on line 31 Fatal error: Undefined class constant 'foo' in /in/Gg10q on line 18
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/Gg10q on line 2
Process exited with code 255.