1--TEST--
2Test ~N operator : various numbers as strings
3--FILE--
4<?php
5
6$strVals = array(
7   "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
8   "a5.9"
9);
10
11
12foreach ($strVals as $strVal) {
13   echo "--- testing: '$strVal' ---\n";
14   var_dump(bin2hex(~$strVal));
15}
16
17?>
18--EXPECT--
19--- testing: '0' ---
20string(2) "cf"
21--- testing: '65' ---
22string(4) "c9ca"
23--- testing: '-44' ---
24string(6) "d2cbcb"
25--- testing: '1.2' ---
26string(6) "ced1cd"
27--- testing: '-7.7' ---
28string(8) "d2c8d1c8"
29--- testing: 'abc' ---
30string(6) "9e9d9c"
31--- testing: '123abc' ---
32string(12) "cecdcc9e9d9c"
33--- testing: '123e5' ---
34string(10) "cecdcc9aca"
35--- testing: '123e5xyz' ---
36string(16) "cecdcc9aca878685"
37--- testing: ' 123abc' ---
38string(14) "dfcecdcc9e9d9c"
39--- testing: '123 abc' ---
40string(14) "cecdccdf9e9d9c"
41--- testing: '123abc ' ---
42string(14) "cecdcc9e9d9cdf"
43--- testing: '3.4a' ---
44string(8) "ccd1cb9e"
45--- testing: 'a5.9' ---
46string(8) "9ecad1c6"
47