3v4l.org

run code in 300+ PHP versions simultaneously
<?php use PDO; class Test { public function getDataType($value) { switch($value) { case is_bool($value): return PDO::PARAM_BOOL; case is_null($value): return PDO::PARAM_NULL; case is_integer($value): return PDO::PARAM_INT; default: return PDO::PARAM_STR; } } } Test::getDataType(true);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Warning: The use statement with non-compound name 'PDO' has no effect in /in/0oL8R on line 3 Fatal error: Uncaught Error: Non-static method Test::getDataType() cannot be called statically in /in/0oL8R:22 Stack trace: #0 {main} thrown in /in/0oL8R on line 22
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Warning: The use statement with non-compound name 'PDO' has no effect in /in/0oL8R on line 3 Deprecated: Non-static method Test::getDataType() should not be called statically in /in/0oL8R on line 22
Output for 7.3.32 - 7.3.33
Warning: The use statement with non-compound name 'PDO' has no effect in /in/0oL8R on line 3
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Warning: The use statement with non-compound name 'PDO' has no effect in /in/0oL8R on line 3 Strict Standards: Non-static method Test::getDataType() should not be called statically in /in/0oL8R on line 22

preferences:
252.5 ms | 402 KiB | 342 Q