3v4l.org

run code in 300+ PHP versions simultaneously
<?php class __invoke { public function __invoke() { static $i = 0; print $i++; } } $a = new __invoke(); $a();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
0
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 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; __invoke has a deprecated constructor in /in/HMgcR on line 3 01
Output for 5.6.0 - 5.6.29, 7.3.32 - 7.3.33
01

preferences:
79.39 ms | 1525 KiB | 4 Q