xref: /php-src/ext/bcmath/tests/number/clone.phpt (revision fad899e5)
1--TEST--
2BcMath\Number clone
3--EXTENSIONS--
4bcmath
5--FILE--
6<?php
7
8$values = [
9    '0',
10    '0.0',
11    '2',
12    '1234',
13    '12.0004',
14    '0.1230',
15    1,
16    12345,
17    '-0',
18    '-0.0',
19    '-2',
20    '-1234',
21    '-12.0004',
22    '-0.1230',
23    -1,
24    -12345,
25];
26
27foreach ($values as $value) {
28    $num = new BcMath\Number($value);
29    $clone = clone $num;
30    if ($num->value !== $clone->value || $num->scale !== $clone->scale || $num === $clone) {
31        echo "Result is incorrect.\n";
32        var_dump($num, $clone);
33    }
34}
35echo 'done!';
36?>
37--EXPECT--
38done!
39