004.phpt 644 B

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