xref: /PHP-7.4/ext/standard/tests/serialize/004.phpt (revision a747e1b7)
1--TEST--
2serialize()/unserialize() floats in array.
3--INI--
4precision=12
5serialize_precision=100
6--FILE--
7<?php
8error_reporting (E_ALL);
9$a      = array(4);
10$str    = serialize($a);
11print('Serialized array: '.$str."\n");
12$b      = unserialize($str);
13print('Unserialized array: ');
14var_dump($b);
15print("\n");
16$str    = serialize(array(4.5));
17print('Serialized array: '.$str."\n");
18$b      = unserialize($str);
19print('Unserialized array: ')   ;
20var_dump($b);
21?>
22--EXPECT--
23Serialized array: a:1:{i:0;i:4;}
24Unserialized array: array(1) {
25  [0]=>
26  int(4)
27}
28
29Serialized array: a:1:{i:0;d:4.5;}
30Unserialized array: array(1) {
31  [0]=>
32  float(4.5)
33}
34