predec_variationStr.phpt 905 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Test --N operator : various numbers as strings
  3. --FILE--
  4. <?php
  5. $strVals = array(
  6. "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
  7. "a5.9"
  8. );
  9. foreach ($strVals as $strVal) {
  10. echo "--- testing: '$strVal' ---\n";
  11. var_dump(--$strVal);
  12. }
  13. ?>
  14. --EXPECT--
  15. --- testing: '0' ---
  16. int(-1)
  17. --- testing: '65' ---
  18. int(64)
  19. --- testing: '-44' ---
  20. int(-45)
  21. --- testing: '1.2' ---
  22. float(0.19999999999999996)
  23. --- testing: '-7.7' ---
  24. float(-8.7)
  25. --- testing: 'abc' ---
  26. string(3) "abc"
  27. --- testing: '123abc' ---
  28. string(6) "123abc"
  29. --- testing: '123e5' ---
  30. float(12299999)
  31. --- testing: '123e5xyz' ---
  32. string(8) "123e5xyz"
  33. --- testing: ' 123abc' ---
  34. string(7) " 123abc"
  35. --- testing: '123 abc' ---
  36. string(7) "123 abc"
  37. --- testing: '123abc ' ---
  38. string(7) "123abc "
  39. --- testing: '3.4a' ---
  40. string(4) "3.4a"
  41. --- testing: 'a5.9' ---
  42. string(4) "a5.9"