string_decimals_001.phpt 515 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. String conversion with multiple decimal points
  3. --FILE--
  4. <?php
  5. function test($str) {
  6. echo "\n--> Testing $str:\n";
  7. var_dump((int)$str);
  8. var_dump((float)$str);
  9. var_dump($str > 0);
  10. }
  11. test("..9");
  12. test(".9.");
  13. test("9..");
  14. test("9.9.");
  15. test("9.9.9");
  16. ?>
  17. --EXPECT--
  18. --> Testing ..9:
  19. int(0)
  20. float(0)
  21. bool(false)
  22. --> Testing .9.:
  23. int(0)
  24. float(0.9)
  25. bool(false)
  26. --> Testing 9..:
  27. int(9)
  28. float(9)
  29. bool(true)
  30. --> Testing 9.9.:
  31. int(9)
  32. float(9.9)
  33. bool(true)
  34. --> Testing 9.9.9:
  35. int(9)
  36. float(9.9)
  37. bool(true)