bitwiseNot_variationStr.phpt 1020 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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(bin2hex(~$strVal));
  12. }
  13. ?>
  14. ===DONE===
  15. --EXPECT--
  16. --- testing: '0' ---
  17. string(2) "cf"
  18. --- testing: '65' ---
  19. string(4) "c9ca"
  20. --- testing: '-44' ---
  21. string(6) "d2cbcb"
  22. --- testing: '1.2' ---
  23. string(6) "ced1cd"
  24. --- testing: '-7.7' ---
  25. string(8) "d2c8d1c8"
  26. --- testing: 'abc' ---
  27. string(6) "9e9d9c"
  28. --- testing: '123abc' ---
  29. string(12) "cecdcc9e9d9c"
  30. --- testing: '123e5' ---
  31. string(10) "cecdcc9aca"
  32. --- testing: '123e5xyz' ---
  33. string(16) "cecdcc9aca878685"
  34. --- testing: ' 123abc' ---
  35. string(14) "dfcecdcc9e9d9c"
  36. --- testing: '123 abc' ---
  37. string(14) "cecdccdf9e9d9c"
  38. --- testing: '123abc ' ---
  39. string(14) "cecdcc9e9d9cdf"
  40. --- testing: '3.4a' ---
  41. string(8) "ccd1cb9e"
  42. --- testing: 'a5.9' ---
  43. string(8) "9ecad1c6"
  44. ===DONE===