1--TEST-- 2BcMath\Number unserialize 3--EXTENSIONS-- 4bcmath 5--FILE-- 6<?php 7 8$values = [ 9 'O:13:"BcMath\Number":1:{s:5:"value";s:1:"0";}', 10 'O:13:"BcMath\Number":1:{s:5:"value";s:3:"0.0";}', 11 'O:13:"BcMath\Number":1:{s:5:"value";s:1:"2";}', 12 'O:13:"BcMath\Number":1:{s:5:"value";s:4:"1234";}', 13 'O:13:"BcMath\Number":1:{s:5:"value";s:7:"12.0004";}', 14 'O:13:"BcMath\Number":1:{s:5:"value";s:6:"0.1230";}', 15 'O:13:"BcMath\Number":1:{s:5:"value";s:1:"1";}', 16 'O:13:"BcMath\Number":1:{s:5:"value";s:5:"12345";}', 17]; 18 19foreach ($values as $value) { 20 $num = unserialize($value); 21 var_dump($num); 22 unset($num); 23} 24?> 25--EXPECT-- 26object(BcMath\Number)#1 (2) { 27 ["value"]=> 28 string(1) "0" 29 ["scale"]=> 30 int(0) 31} 32object(BcMath\Number)#1 (2) { 33 ["value"]=> 34 string(3) "0.0" 35 ["scale"]=> 36 int(1) 37} 38object(BcMath\Number)#1 (2) { 39 ["value"]=> 40 string(1) "2" 41 ["scale"]=> 42 int(0) 43} 44object(BcMath\Number)#1 (2) { 45 ["value"]=> 46 string(4) "1234" 47 ["scale"]=> 48 int(0) 49} 50object(BcMath\Number)#1 (2) { 51 ["value"]=> 52 string(7) "12.0004" 53 ["scale"]=> 54 int(4) 55} 56object(BcMath\Number)#1 (2) { 57 ["value"]=> 58 string(6) "0.1230" 59 ["scale"]=> 60 int(4) 61} 62object(BcMath\Number)#1 (2) { 63 ["value"]=> 64 string(1) "1" 65 ["scale"]=> 66 int(0) 67} 68object(BcMath\Number)#1 (2) { 69 ["value"]=> 70 string(5) "12345" 71 ["scale"]=> 72 int(0) 73} 74