3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'Hexadecimal', \PHP_EOL; try { var_dump(gmp_init('0X')); } catch (\TypeError $e) { echo $e->getMessage(), \PHP_EOL; } try { var_dump(gmp_init('0x')); } catch (\TypeError $e) { echo $e->getMessage(), \PHP_EOL; } try { var_dump(gmp_init('0X', 16)); } catch (\TypeError $e) { echo $e->getMessage(), \PHP_EOL; } try { var_dump(gmp_init('0x', 16)); } catch (\TypeError $e) { echo $e->getMessage(), \PHP_EOL; } echo 'Binary', \PHP_EOL; try { var_dump(gmp_init('0B')); } catch (\TypeError $e) { echo $e->getMessage(), \PHP_EOL; } try { var_dump(gmp_init('0b')); } catch (\TypeError $e) { echo $e->getMessage(), \PHP_EOL; } try { var_dump(gmp_init('0B', 2)); } catch (\TypeError $e) { echo $e->getMessage(), \PHP_EOL; } try { var_dump(gmp_init('0b', 2)); } catch (\TypeError $e) { echo $e->getMessage(), \PHP_EOL; } echo "Done\n";
Output for 8.0.2 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Hexadecimal Fatal error: Uncaught ValueError: gmp_init(): Argument #1 ($num) is not an integer string in /in/ArU7r:4 Stack trace: #0 /in/ArU7r(4): gmp_init('0X') #1 {main} thrown in /in/ArU7r on line 4
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Hexadecimal Fatal error: Uncaught ValueError: gmp_init(): Argument #1 ($num) is not an integer string in /in/ArU7r:4 Stack trace: #0 /in/ArU7r(4): gmp_init('0X') #1 {main} thrown in /in/ArU7r on line 4
Process exited with code 255.
Output for 7.3.32, 7.4.26, 7.4.33, 8.0.13
Hexadecimal Fatal error: Uncaught Error: Call to undefined function gmp_init() in /in/ArU7r:4 Stack trace: #0 {main} thrown in /in/ArU7r on line 4
Process exited with code 255.
Output for 8.0.0 - 8.0.1
Hexadecimal object(GMP)#1 (1) { ["num"]=> string(1) "0" } object(GMP)#1 (1) { ["num"]=> string(1) "0" } gmp_init(): Argument #1 ($num) is not an integer string gmp_init(): Argument #1 ($num) is not an integer string Binary object(GMP)#2 (1) { ["num"]=> string(1) "0" } object(GMP)#2 (1) { ["num"]=> string(1) "0" } gmp_init(): Argument #1 ($num) is not an integer string gmp_init(): Argument #1 ($num) is not an integer string Done
Output for 7.3.0 - 7.3.31, 7.3.33, 7.4.0 - 7.4.25, 7.4.27 - 7.4.32
Hexadecimal object(GMP)#1 (1) { ["num"]=> string(1) "0" } object(GMP)#1 (1) { ["num"]=> string(1) "0" } Warning: gmp_init(): Unable to convert variable to GMP - string is not an integer in /in/ArU7r on line 14 bool(false) Warning: gmp_init(): Unable to convert variable to GMP - string is not an integer in /in/ArU7r on line 19 bool(false) Binary object(GMP)#1 (1) { ["num"]=> string(1) "0" } object(GMP)#1 (1) { ["num"]=> string(1) "0" } Warning: gmp_init(): Unable to convert variable to GMP - string is not an integer in /in/ArU7r on line 36 bool(false) Warning: gmp_init(): Unable to convert variable to GMP - string is not an integer in /in/ArU7r on line 41 bool(false) Done

preferences:
157.34 ms | 403 KiB | 149 Q