3v4l.org

run code in 500+ PHP versions simultaneously
<?php abstract class ModelRecord { const TABLE = ''; const PRIMARY = ''; public function load($id) { if(self::TABLE === static::TABLE OR self::PRIMARY === static::PRIMARY) throw new UnexpectedValueException("TABLE or PRIMARY const not implemented"); var_dump(static::TABLE, static::PRIMARY); } } class User extends ModelRecord { const TABLE = 'users'; const PRIMARY = 'id'; } class Contact extends ModelRecord { } (new User)->load(1); (new Contact)->load(2);
Output for 7.1.0, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.31, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
string(5) "users" string(2) "id" Fatal error: Uncaught UnexpectedValueException: TABLE or PRIMARY const not implemented in /in/AlUal:10 Stack trace: #0 /in/AlUal(26): ModelRecord->load(2) #1 {main} thrown in /in/AlUal on line 10
Process exited with code 255.
Output for 5.5.4, 5.6.32
string(5) "users" string(2) "id" Fatal error: Uncaught exception 'UnexpectedValueException' with message 'TABLE or PRIMARY const not implemented' in /in/AlUal:10 Stack trace: #0 /in/AlUal(26): ModelRecord->load(2) #1 {main} thrown in /in/AlUal on line 10
Process exited with code 255.

preferences:
101.68 ms | 1552 KiB | 4 Q