3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tokens = token_get_all( '<?php $foo = 0xCAFE_F00D; $foo = 0x42_72_6F_77_6E;' ); foreach ($tokens as $token) { if (is_array($token)) { echo "Line {$token[2]}: ", token_name($token[0]), " ('{$token[1]}')", PHP_EOL; } }
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
Line 1: T_OPEN_TAG ('<?php ') Line 2: T_VARIABLE ('$foo') Line 2: T_WHITESPACE (' ') Line 2: T_WHITESPACE (' ') Line 2: T_LNUMBER ('0xCAFE_F00D') Line 2: T_WHITESPACE (' ') Line 3: T_VARIABLE ('$foo') Line 3: T_WHITESPACE (' ') Line 3: T_WHITESPACE (' ') Line 3: T_LNUMBER ('0x42_72_6F_77_6E')
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 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Line 1: T_OPEN_TAG ('<?php ') Line 2: T_VARIABLE ('$foo') Line 2: T_WHITESPACE (' ') Line 2: T_WHITESPACE (' ') Line 2: T_LNUMBER ('0xCAFE') Line 2: T_STRING ('_F00D') Line 2: T_WHITESPACE (' ') Line 3: T_VARIABLE ('$foo') Line 3: T_WHITESPACE (' ') Line 3: T_WHITESPACE (' ') Line 3: T_LNUMBER ('0x42') Line 3: T_STRING ('_72_6F_77_6E')

preferences:
186.35 ms | 410 KiB | 5 Q