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--EXTENSIONS-- 8bcmath 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 49try { 50 echo bcadd("1.a", "2"); 51} catch (\ValueError $e) { 52 echo $e->getMessage() . PHP_EOL; 53} 54 55echo "\n"; 56 57echo bccomp("1", "2"),"\n"; 58echo bccomp("1.1", "2", 2),"\n"; 59echo bccomp("", "2"),"\n"; 60echo bccomp("+0", "2"), "\n"; 61echo bccomp("-0", "2"), "\n"; 62 63echo "\n"; 64 65try { 66 echo bccomp(" 0", "2"); 67} catch (\ValueError $e) { 68 echo $e->getMessage() . PHP_EOL; 69} 70 71try { 72 echo bccomp("1e1", "2"); 73} catch (\ValueError $e) { 74 echo $e->getMessage() . PHP_EOL; 75} 76 77try { 78 echo bccomp("1,1", "2"); 79} catch (\ValueError $e) { 80 echo $e->getMessage() . PHP_EOL; 81} 82 83try { 84 echo bccomp("Hello", "2"); 85} catch (\ValueError $e) { 86 echo $e->getMessage() . PHP_EOL; 87} 88 89try { 90 echo bccomp("1 1", "2"); 91} catch (\ValueError $e) { 92 echo $e->getMessage() . PHP_EOL; 93} 94 95?> 96--EXPECT-- 973 983.10 992.00 1002 1012 102 103bcadd(): Argument #1 ($num1) is not well-formed 104bcadd(): Argument #1 ($num1) is not well-formed 105bcadd(): Argument #1 ($num1) is not well-formed 106bcadd(): Argument #1 ($num1) is not well-formed 107bcadd(): Argument #1 ($num1) is not well-formed 108bcadd(): Argument #1 ($num1) is not well-formed 109 110-1 111-1 112-1 113-1 114-1 115 116bccomp(): Argument #1 ($num1) is not well-formed 117bccomp(): Argument #1 ($num1) is not well-formed 118bccomp(): Argument #1 ($num1) is not well-formed 119bccomp(): Argument #1 ($num1) is not well-formed 120bccomp(): Argument #1 ($num1) is not well-formed 121