3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function getDataType($value) { switch($value) { case is_bool($value): return 'bool'; case is_null($value): return null; case is_integer($value): return 'int'; default: return 'str'; } } } Test::getDataType(true);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught Error: Non-static method Test::getDataType() cannot be called statically in /in/SEcur:20 Stack trace: #0 {main} thrown in /in/SEcur on line 20
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Deprecated: Non-static method Test::getDataType() should not be called statically in /in/SEcur on line 20
Output for 7.3.32 - 7.3.33
Output for 5.4.1 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Strict Standards: Non-static method Test::getDataType() should not be called statically in /in/SEcur on line 20

preferences:
196.16 ms | 402 KiB | 268 Q