mirror of
https://github.com/php/php-src.git
synced 2026-04-23 16:08:35 +02:00
fad899e566
Added BcMath\Number class. It is an immutable object, has methods that are equivalent to existing BCMath calculation functions, and can also be calculated using operators. The existing BCMath function returned a string for each calculation, but this class returns an object. RFC: https://wiki.php.net/rfc/support_object_type_in_bcmath, https://wiki.php.net/rfc/fix_up_bcmath_number_class --------- Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
24 lines
455 B
PHP
24 lines
455 B
PHP
--TEST--
|
|
BcMath\Number construct error
|
|
--EXTENSIONS--
|
|
bcmath
|
|
--FILE--
|
|
<?php
|
|
try {
|
|
$num = new BcMath\Number('1');
|
|
$num->__construct(5);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage() . "\n";
|
|
}
|
|
|
|
try {
|
|
$num = new BcMath\Number('a');
|
|
var_dump($num);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage() . "\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
Cannot modify readonly property BcMath\Number::$value
|
|
BcMath\Number::__construct(): Argument #1 ($num) is not well-formed
|