3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo; for ($i=0; $i<10; $i++){ echo $i." : ".strlen($i)."\n"; if ($i==5){ function strlen($x){return "hello";} } }
Output for 5.4.45, 5.6.40, 8.0.1 - 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
0 : 1 1 : 1 2 : 1 3 : 1 4 : 1 5 : 1 6 : 1 7 : 1 8 : 1 9 : 1
Output for 5.3.8 - 5.3.29
0 : 1 1 : 1 2 : 1 3 : 1 4 : 1 5 : 1 6 : hello 7 : hello 8 : hello 9 : hello

preferences:
79.85 ms | 407 KiB | 5 Q