3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); //the only right example var_dump( bcadd('17.123', '19.456', 10) ); //can't do this (changes are only in the first part), just all the cases that are inappropriate for bcmath //whitespace var_dump( bcadd('17 .123', '19.456', 10) ); //comma var_dump( bcadd('17,123', '19.456', 10) ); //comma as thousands separator var_dump( bcadd('1,700.123', '19.456', 10) ); //changing locale to a country which uses decimal comma, see this https://bugs.php.net/bug.php?id=55160 $currentLocale = setlocale(LC_ALL, 0); setlocale(LC_ALL, "en_DK.UTF-8"); var_dump( bcadd('1,700.123', '19.456', 10) ); setlocale(LC_ALL, $currentLocale); //exponential numbers var_dump( bcadd('17e123', '19.456', 10) ); //using words var_dump( bcadd('hello', '19.456', 10) );
Output for git.master, git.master_jit, rfc.property-hooks
string(13) "36.5790000000" Fatal error: Uncaught ValueError: bcadd(): Argument #1 ($num1) is not well-formed in /in/D3s7J:13 Stack trace: #0 /in/D3s7J(13): bcadd('17 .123', '19.456', 10) #1 {main} thrown in /in/D3s7J on line 13
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
132.81 ms | 406 KiB | 5 Q