3v4l.org

run code in 300+ PHP versions simultaneously
<?php $b = 'b_global'; function foo(bool $shadow) { $a = 'a_local'; $b = 'b_local'; var_dump($a, $b); if ( $shadow ) { static $a; global $b; } var_dump($a, $b); } foo(true); echo "----\n"; foo(false);
Output for 8.3.5 - 8.3.28, 8.4.9 - 8.4.15, 8.5.0
string(7) "a_local" string(7) "b_local" NULL string(8) "b_global" ---- string(7) "a_local" string(7) "b_local" string(7) "a_local" string(7) "b_local"

preferences:
49.59 ms | 406 KiB | 5 Q