3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); class foo { function foo() { echo 'I am the constructor'; } } $obj = new foo(); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
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: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in /in/p0K0l on line 5 I am the constructor
Output for 7.3.32 - 7.3.33
I am the constructor

preferences:
155.76 ms | 408 KiB | 5 Q