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.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 8.3.5 - 8.3.27, 8.4.9 - 8.4.14
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:
52.86 ms | 408 KiB | 5 Q