1--TEST--
2BcMath\Number operator compound assignment
3--EXTENSIONS--
4bcmath
5--FILE--
6<?php
7
8echo "========== add ==========\n";
9$num = new BcMath\Number(100);
10$num_old = $num;
11$num += 100;
12echo $num . "\n";
13$num += '50';
14echo $num . "\n";
15$num += (new BcMath\Number(30));
16echo $num . "\n";
17echo 'old: ' . $num_old . "\n";
18echo "\n";
19
20echo "========== sub ==========\n";
21$num = new BcMath\Number(100);
22$num_old = $num;
23$num -= 100;
24echo $num . "\n";
25$num -= '50';
26echo $num . "\n";
27$num -= (new BcMath\Number(30));
28echo $num . "\n";
29echo 'old: ' . $num_old . "\n";
30echo "\n";
31
32echo "========== mul ==========\n";
33$num = new BcMath\Number(100);
34$num_old = $num;
35$num *= 100;
36echo $num . "\n";
37$num *= '50';
38echo $num . "\n";
39$num *= (new BcMath\Number(30));
40echo $num . "\n";
41echo 'old: ' . $num_old . "\n";
42echo "\n";
43
44echo "========== div ==========\n";
45$num = new BcMath\Number(100);
46$num_old = $num;
47$num /= 100;
48echo $num . "\n";
49$num /= '50';
50echo $num . "\n";
51$num /= (new BcMath\Number(30));
52echo $num . "\n";
53echo 'old: ' . $num_old . "\n";
54echo "\n";
55
56echo "========== mod ==========\n";
57$num = new BcMath\Number(1000);
58$num_old = $num;
59$num %= 90;
60echo $num . "\n";
61$num %= '30';
62echo $num . "\n";
63$num %= (new BcMath\Number(6));
64echo $num . "\n";
65echo 'old: ' . $num_old . "\n";
66echo "\n";
67
68echo "========== pow ==========\n";
69$num = new BcMath\Number(10);
70$num_old = $num;
71$num **= 2;
72echo $num . "\n";
73$num **= '3';
74echo $num . "\n";
75$num **= (new BcMath\Number(0));
76echo $num . "\n";
77echo 'old: ' . $num_old . "\n";
78echo "\n";
79?>
80--EXPECT--
81========== add ==========
82200
83250
84280
85old: 100
86
87========== sub ==========
880
89-50
90-80
91old: 100
92
93========== mul ==========
9410000
95500000
9615000000
97old: 100
98
99========== div ==========
1001
1010.02
1020.000666666666
103old: 100
104
105========== mod ==========
10610
10710
1084
109old: 1000
110
111========== pow ==========
112100
1131000000
1141
115old: 10
116