3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); error_reporting(E_ALL); class foo { protected $string = ''; } class foobar extends foo { protected string $string = ''; } $c1 = new foo(); $c2 = new foobar();
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.5
Fatal error: Type of foobar::$string must not be defined (as in class foo) in /in/EYkNC on line 11
Process exited with code 255.
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.18
Fatal error: Type of foobar::$string must not be defined (as in class foo) in /in/EYkNC on line 14
Process exited with code 255.

preferences:
23.1 ms | 1167 KiB | 5 Q