1--TEST--
2BcMath\Number properties isset, empty, exists
3--EXTENSIONS--
4bcmath
5--FILE--
6<?php
7
8$zero = new BcMath\Number(0);
9$one = new BcMath\Number(1);
10$has_frac = new BcMath\Number('5.67');
11
12echo "========== isset ==========\n";
13var_dump([
14    'zero' => [
15        'value' => isset($zero->value),
16        'scale' => isset($zero->scale),
17    ],
18    'one' => [
19        'value' => isset($one->value),
20        'scale' => isset($one->scale),
21    ],
22    'has_frac' => [
23        'value' => isset($has_frac->value),
24        'scale' => isset($has_frac->scale),
25    ],
26]);
27echo "\n";
28
29echo "========== empty ==========\n";
30var_dump([
31    'zero' => [
32        'value' => empty($zero->value),
33        'scale' => empty($zero->scale),
34    ],
35    'one' => [
36        'value' => empty($one->value),
37        'scale' => empty($one->scale),
38    ],
39    'has_frac' => [
40        'value' => empty($has_frac->value),
41        'scale' => empty($has_frac->scale),
42    ],
43]);
44echo "\n";
45
46echo "========== property_exists ==========\n";
47var_dump([
48    'zero' => [
49        'value' => property_exists($zero, 'value'),
50        'scale' => property_exists($zero, 'scale'),
51    ],
52    'one' => [
53        'value' => property_exists($one, 'value'),
54        'scale' => property_exists($one, 'scale'),
55    ],
56    'has_frac' => [
57        'value' => property_exists($has_frac, 'value'),
58        'scale' => property_exists($has_frac, 'scale'),
59    ],
60]);
61?>
62--EXPECT--
63========== isset ==========
64array(3) {
65  ["zero"]=>
66  array(2) {
67    ["value"]=>
68    bool(true)
69    ["scale"]=>
70    bool(true)
71  }
72  ["one"]=>
73  array(2) {
74    ["value"]=>
75    bool(true)
76    ["scale"]=>
77    bool(true)
78  }
79  ["has_frac"]=>
80  array(2) {
81    ["value"]=>
82    bool(true)
83    ["scale"]=>
84    bool(true)
85  }
86}
87
88========== empty ==========
89array(3) {
90  ["zero"]=>
91  array(2) {
92    ["value"]=>
93    bool(true)
94    ["scale"]=>
95    bool(true)
96  }
97  ["one"]=>
98  array(2) {
99    ["value"]=>
100    bool(false)
101    ["scale"]=>
102    bool(true)
103  }
104  ["has_frac"]=>
105  array(2) {
106    ["value"]=>
107    bool(false)
108    ["scale"]=>
109    bool(false)
110  }
111}
112
113========== property_exists ==========
114array(3) {
115  ["zero"]=>
116  array(2) {
117    ["value"]=>
118    bool(true)
119    ["scale"]=>
120    bool(true)
121  }
122  ["one"]=>
123  array(2) {
124    ["value"]=>
125    bool(true)
126    ["scale"]=>
127    bool(true)
128  }
129  ["has_frac"]=>
130  array(2) {
131    ["value"]=>
132    bool(true)
133    ["scale"]=>
134    bool(true)
135  }
136}
137