decoct_basic.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --TEST--
  2. Test decoct() - basic function test decoct()
  3. --FILE--
  4. <?php
  5. $values = array(10,
  6. 3950.5,
  7. 3.9505e3,
  8. 03,
  9. 0x5F,
  10. "10",
  11. "3950.5",
  12. "3.9505e3",
  13. "039",
  14. "0x5F",
  15. true,
  16. false,
  17. );
  18. foreach ($values as $value) {
  19. try {
  20. var_dump(decoct($value));
  21. } catch (TypeError $exception) {
  22. echo $exception->getMessage() . "\n";
  23. }
  24. }
  25. ?>
  26. --EXPECTF--
  27. string(2) "12"
  28. Deprecated: Implicit conversion from float 3950.5 to int loses precision in %s on line %d
  29. string(4) "7556"
  30. Deprecated: Implicit conversion from float 3950.5 to int loses precision in %s on line %d
  31. string(4) "7556"
  32. string(1) "3"
  33. string(3) "137"
  34. string(2) "12"
  35. Deprecated: Implicit conversion from float-string "3950.5" to int loses precision in %s on line %d
  36. string(4) "7556"
  37. Deprecated: Implicit conversion from float-string "3.9505e3" to int loses precision in %s on line %d
  38. string(4) "7556"
  39. string(2) "47"
  40. decoct(): Argument #1 ($num) must be of type int, string given
  41. string(1) "1"
  42. string(1) "0"