1--TEST-- 2bcmath lib arguments formatting 3--DESCRIPTION-- 41 and 2 argument of bcadd/bcsub/bcmul/bcdiv/bcmod/bcpowmod/bcpow/bccomp (last one works different then others internally); 51 argument of bcsqrt 6All of the name above must be well-formed 7--SKIPIF-- 8<?php if(!extension_loaded("bcmath")) print "skip"; ?> 9--FILE-- 10<?php 11echo bcadd("1", "2"),"\n"; 12echo bcadd("1.1", "2", 2),"\n"; 13echo bcadd("", "2", 2),"\n"; 14echo bcadd("+0", "2"), "\n"; 15echo bcadd("-0", "2"), "\n"; 16 17echo "\n"; 18 19try { 20 echo bcadd(" 0", "2"); 21} catch (\ValueError $e) { 22 echo $e->getMessage() . PHP_EOL; 23} 24 25try { 26 echo bcadd("1e1", "2"); 27} catch (\ValueError $e) { 28 echo $e->getMessage() . PHP_EOL; 29} 30 31try { 32 echo bcadd("1,1", "2"); 33} catch (\ValueError $e) { 34 echo $e->getMessage() . PHP_EOL; 35} 36 37try { 38 echo bcadd("Hello", "2"); 39} catch (\ValueError $e) { 40 echo $e->getMessage() . PHP_EOL; 41} 42 43try { 44 echo bcadd("1 1", "2"); 45} catch (\ValueError $e) { 46 echo $e->getMessage() . PHP_EOL; 47} 48 49echo "\n"; 50 51echo bccomp("1", "2"),"\n"; 52echo bccomp("1.1", "2", 2),"\n"; 53echo bccomp("", "2"),"\n"; 54echo bccomp("+0", "2"), "\n"; 55echo bccomp("-0", "2"), "\n"; 56 57echo "\n"; 58 59try { 60 echo bccomp(" 0", "2"); 61} catch (\ValueError $e) { 62 echo $e->getMessage() . PHP_EOL; 63} 64 65try { 66 echo bccomp("1e1", "2"); 67} catch (\ValueError $e) { 68 echo $e->getMessage() . PHP_EOL; 69} 70 71try { 72 echo bccomp("1,1", "2"); 73} catch (\ValueError $e) { 74 echo $e->getMessage() . PHP_EOL; 75} 76 77try { 78 echo bccomp("Hello", "2"); 79} catch (\ValueError $e) { 80 echo $e->getMessage() . PHP_EOL; 81} 82 83try { 84 echo bccomp("1 1", "2"); 85} catch (\ValueError $e) { 86 echo $e->getMessage() . PHP_EOL; 87} 88 89?> 90--EXPECTF-- 913 923.10 932.00 942 952 96 97bcadd(): Argument #1 ($num1) is not well-formed 98bcadd(): Argument #1 ($num1) is not well-formed 99bcadd(): Argument #1 ($num1) is not well-formed 100bcadd(): Argument #1 ($num1) is not well-formed 101bcadd(): Argument #1 ($num1) is not well-formed 102 103-1 104-1 105-1 106-1 107-1 108 109bccomp(): Argument #1 ($num1) is not well-formed 110bccomp(): Argument #1 ($num1) is not well-formed 111bccomp(): Argument #1 ($num1) is not well-formed 112bccomp(): Argument #1 ($num1) is not well-formed 113bccomp(): Argument #1 ($num1) is not well-formed