3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function setId(int $id) { $this->id = $id; } setId('1');
based on 1mq8L
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to setId() must be of the type integer, string given, called in /in/iHD7Q on line 8 and defined in /in/iHD7Q:4 Stack trace: #0 /in/iHD7Q(8): setId('1') #1 {main} thrown in /in/iHD7Q on line 4
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/iHD7Q on line 2 Catchable fatal error: Argument 1 passed to setId() must be an instance of int, string given, called in /in/iHD7Q on line 8 and defined in /in/iHD7Q on line 4
Process exited with code 255.