1--TEST-- 2Test / 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 11error_reporting(E_ERROR); 12 13foreach ($strVals as $strVal) { 14 foreach($strVals as $otherVal) { 15 echo "--- testing: '$strVal' / '$otherVal' ---\n"; 16 var_dump($strVal/$otherVal); 17 } 18} 19 20 21?> 22===DONE=== 23--EXPECT-- 24--- testing: '0' / '0' --- 25bool(false) 26--- testing: '0' / '65' --- 27int(0) 28--- testing: '0' / '-44' --- 29int(0) 30--- testing: '0' / '1.2' --- 31float(0) 32--- testing: '0' / '-7.7' --- 33float(-0) 34--- testing: '0' / 'abc' --- 35bool(false) 36--- testing: '0' / '123abc' --- 37int(0) 38--- testing: '0' / '123e5' --- 39float(0) 40--- testing: '0' / '123e5xyz' --- 41float(0) 42--- testing: '0' / ' 123abc' --- 43int(0) 44--- testing: '0' / '123 abc' --- 45int(0) 46--- testing: '0' / '123abc ' --- 47int(0) 48--- testing: '0' / '3.4a' --- 49float(0) 50--- testing: '0' / 'a5.9' --- 51bool(false) 52--- testing: '65' / '0' --- 53bool(false) 54--- testing: '65' / '65' --- 55int(1) 56--- testing: '65' / '-44' --- 57float(-1.4772727272727) 58--- testing: '65' / '1.2' --- 59float(54.166666666667) 60--- testing: '65' / '-7.7' --- 61float(-8.4415584415584) 62--- testing: '65' / 'abc' --- 63bool(false) 64--- testing: '65' / '123abc' --- 65float(0.52845528455285) 66--- testing: '65' / '123e5' --- 67float(5.2845528455285E-6) 68--- testing: '65' / '123e5xyz' --- 69float(5.2845528455285E-6) 70--- testing: '65' / ' 123abc' --- 71float(0.52845528455285) 72--- testing: '65' / '123 abc' --- 73float(0.52845528455285) 74--- testing: '65' / '123abc ' --- 75float(0.52845528455285) 76--- testing: '65' / '3.4a' --- 77float(19.117647058824) 78--- testing: '65' / 'a5.9' --- 79bool(false) 80--- testing: '-44' / '0' --- 81bool(false) 82--- testing: '-44' / '65' --- 83float(-0.67692307692308) 84--- testing: '-44' / '-44' --- 85int(1) 86--- testing: '-44' / '1.2' --- 87float(-36.666666666667) 88--- testing: '-44' / '-7.7' --- 89float(5.7142857142857) 90--- testing: '-44' / 'abc' --- 91bool(false) 92--- testing: '-44' / '123abc' --- 93float(-0.35772357723577) 94--- testing: '-44' / '123e5' --- 95float(-3.5772357723577E-6) 96--- testing: '-44' / '123e5xyz' --- 97float(-3.5772357723577E-6) 98--- testing: '-44' / ' 123abc' --- 99float(-0.35772357723577) 100--- testing: '-44' / '123 abc' --- 101float(-0.35772357723577) 102--- testing: '-44' / '123abc ' --- 103float(-0.35772357723577) 104--- testing: '-44' / '3.4a' --- 105float(-12.941176470588) 106--- testing: '-44' / 'a5.9' --- 107bool(false) 108--- testing: '1.2' / '0' --- 109bool(false) 110--- testing: '1.2' / '65' --- 111float(0.018461538461538) 112--- testing: '1.2' / '-44' --- 113float(-0.027272727272727) 114--- testing: '1.2' / '1.2' --- 115float(1) 116--- testing: '1.2' / '-7.7' --- 117float(-0.15584415584416) 118--- testing: '1.2' / 'abc' --- 119bool(false) 120--- testing: '1.2' / '123abc' --- 121float(0.0097560975609756) 122--- testing: '1.2' / '123e5' --- 123float(9.7560975609756E-8) 124--- testing: '1.2' / '123e5xyz' --- 125float(9.7560975609756E-8) 126--- testing: '1.2' / ' 123abc' --- 127float(0.0097560975609756) 128--- testing: '1.2' / '123 abc' --- 129float(0.0097560975609756) 130--- testing: '1.2' / '123abc ' --- 131float(0.0097560975609756) 132--- testing: '1.2' / '3.4a' --- 133float(0.35294117647059) 134--- testing: '1.2' / 'a5.9' --- 135bool(false) 136--- testing: '-7.7' / '0' --- 137bool(false) 138--- testing: '-7.7' / '65' --- 139float(-0.11846153846154) 140--- testing: '-7.7' / '-44' --- 141float(0.175) 142--- testing: '-7.7' / '1.2' --- 143float(-6.4166666666667) 144--- testing: '-7.7' / '-7.7' --- 145float(1) 146--- testing: '-7.7' / 'abc' --- 147bool(false) 148--- testing: '-7.7' / '123abc' --- 149float(-0.06260162601626) 150--- testing: '-7.7' / '123e5' --- 151float(-6.260162601626E-7) 152--- testing: '-7.7' / '123e5xyz' --- 153float(-6.260162601626E-7) 154--- testing: '-7.7' / ' 123abc' --- 155float(-0.06260162601626) 156--- testing: '-7.7' / '123 abc' --- 157float(-0.06260162601626) 158--- testing: '-7.7' / '123abc ' --- 159float(-0.06260162601626) 160--- testing: '-7.7' / '3.4a' --- 161float(-2.2647058823529) 162--- testing: '-7.7' / 'a5.9' --- 163bool(false) 164--- testing: 'abc' / '0' --- 165bool(false) 166--- testing: 'abc' / '65' --- 167int(0) 168--- testing: 'abc' / '-44' --- 169int(0) 170--- testing: 'abc' / '1.2' --- 171float(0) 172--- testing: 'abc' / '-7.7' --- 173float(-0) 174--- testing: 'abc' / 'abc' --- 175bool(false) 176--- testing: 'abc' / '123abc' --- 177int(0) 178--- testing: 'abc' / '123e5' --- 179float(0) 180--- testing: 'abc' / '123e5xyz' --- 181float(0) 182--- testing: 'abc' / ' 123abc' --- 183int(0) 184--- testing: 'abc' / '123 abc' --- 185int(0) 186--- testing: 'abc' / '123abc ' --- 187int(0) 188--- testing: 'abc' / '3.4a' --- 189float(0) 190--- testing: 'abc' / 'a5.9' --- 191bool(false) 192--- testing: '123abc' / '0' --- 193bool(false) 194--- testing: '123abc' / '65' --- 195float(1.8923076923077) 196--- testing: '123abc' / '-44' --- 197float(-2.7954545454545) 198--- testing: '123abc' / '1.2' --- 199float(102.5) 200--- testing: '123abc' / '-7.7' --- 201float(-15.974025974026) 202--- testing: '123abc' / 'abc' --- 203bool(false) 204--- testing: '123abc' / '123abc' --- 205int(1) 206--- testing: '123abc' / '123e5' --- 207float(1.0E-5) 208--- testing: '123abc' / '123e5xyz' --- 209float(1.0E-5) 210--- testing: '123abc' / ' 123abc' --- 211int(1) 212--- testing: '123abc' / '123 abc' --- 213int(1) 214--- testing: '123abc' / '123abc ' --- 215int(1) 216--- testing: '123abc' / '3.4a' --- 217float(36.176470588235) 218--- testing: '123abc' / 'a5.9' --- 219bool(false) 220--- testing: '123e5' / '0' --- 221bool(false) 222--- testing: '123e5' / '65' --- 223float(189230.76923077) 224--- testing: '123e5' / '-44' --- 225float(-279545.45454545) 226--- testing: '123e5' / '1.2' --- 227float(10250000) 228--- testing: '123e5' / '-7.7' --- 229float(-1597402.5974026) 230--- testing: '123e5' / 'abc' --- 231bool(false) 232--- testing: '123e5' / '123abc' --- 233float(100000) 234--- testing: '123e5' / '123e5' --- 235float(1) 236--- testing: '123e5' / '123e5xyz' --- 237float(1) 238--- testing: '123e5' / ' 123abc' --- 239float(100000) 240--- testing: '123e5' / '123 abc' --- 241float(100000) 242--- testing: '123e5' / '123abc ' --- 243float(100000) 244--- testing: '123e5' / '3.4a' --- 245float(3617647.0588235) 246--- testing: '123e5' / 'a5.9' --- 247bool(false) 248--- testing: '123e5xyz' / '0' --- 249bool(false) 250--- testing: '123e5xyz' / '65' --- 251float(189230.76923077) 252--- testing: '123e5xyz' / '-44' --- 253float(-279545.45454545) 254--- testing: '123e5xyz' / '1.2' --- 255float(10250000) 256--- testing: '123e5xyz' / '-7.7' --- 257float(-1597402.5974026) 258--- testing: '123e5xyz' / 'abc' --- 259bool(false) 260--- testing: '123e5xyz' / '123abc' --- 261float(100000) 262--- testing: '123e5xyz' / '123e5' --- 263float(1) 264--- testing: '123e5xyz' / '123e5xyz' --- 265float(1) 266--- testing: '123e5xyz' / ' 123abc' --- 267float(100000) 268--- testing: '123e5xyz' / '123 abc' --- 269float(100000) 270--- testing: '123e5xyz' / '123abc ' --- 271float(100000) 272--- testing: '123e5xyz' / '3.4a' --- 273float(3617647.0588235) 274--- testing: '123e5xyz' / 'a5.9' --- 275bool(false) 276--- testing: ' 123abc' / '0' --- 277bool(false) 278--- testing: ' 123abc' / '65' --- 279float(1.8923076923077) 280--- testing: ' 123abc' / '-44' --- 281float(-2.7954545454545) 282--- testing: ' 123abc' / '1.2' --- 283float(102.5) 284--- testing: ' 123abc' / '-7.7' --- 285float(-15.974025974026) 286--- testing: ' 123abc' / 'abc' --- 287bool(false) 288--- testing: ' 123abc' / '123abc' --- 289int(1) 290--- testing: ' 123abc' / '123e5' --- 291float(1.0E-5) 292--- testing: ' 123abc' / '123e5xyz' --- 293float(1.0E-5) 294--- testing: ' 123abc' / ' 123abc' --- 295int(1) 296--- testing: ' 123abc' / '123 abc' --- 297int(1) 298--- testing: ' 123abc' / '123abc ' --- 299int(1) 300--- testing: ' 123abc' / '3.4a' --- 301float(36.176470588235) 302--- testing: ' 123abc' / 'a5.9' --- 303bool(false) 304--- testing: '123 abc' / '0' --- 305bool(false) 306--- testing: '123 abc' / '65' --- 307float(1.8923076923077) 308--- testing: '123 abc' / '-44' --- 309float(-2.7954545454545) 310--- testing: '123 abc' / '1.2' --- 311float(102.5) 312--- testing: '123 abc' / '-7.7' --- 313float(-15.974025974026) 314--- testing: '123 abc' / 'abc' --- 315bool(false) 316--- testing: '123 abc' / '123abc' --- 317int(1) 318--- testing: '123 abc' / '123e5' --- 319float(1.0E-5) 320--- testing: '123 abc' / '123e5xyz' --- 321float(1.0E-5) 322--- testing: '123 abc' / ' 123abc' --- 323int(1) 324--- testing: '123 abc' / '123 abc' --- 325int(1) 326--- testing: '123 abc' / '123abc ' --- 327int(1) 328--- testing: '123 abc' / '3.4a' --- 329float(36.176470588235) 330--- testing: '123 abc' / 'a5.9' --- 331bool(false) 332--- testing: '123abc ' / '0' --- 333bool(false) 334--- testing: '123abc ' / '65' --- 335float(1.8923076923077) 336--- testing: '123abc ' / '-44' --- 337float(-2.7954545454545) 338--- testing: '123abc ' / '1.2' --- 339float(102.5) 340--- testing: '123abc ' / '-7.7' --- 341float(-15.974025974026) 342--- testing: '123abc ' / 'abc' --- 343bool(false) 344--- testing: '123abc ' / '123abc' --- 345int(1) 346--- testing: '123abc ' / '123e5' --- 347float(1.0E-5) 348--- testing: '123abc ' / '123e5xyz' --- 349float(1.0E-5) 350--- testing: '123abc ' / ' 123abc' --- 351int(1) 352--- testing: '123abc ' / '123 abc' --- 353int(1) 354--- testing: '123abc ' / '123abc ' --- 355int(1) 356--- testing: '123abc ' / '3.4a' --- 357float(36.176470588235) 358--- testing: '123abc ' / 'a5.9' --- 359bool(false) 360--- testing: '3.4a' / '0' --- 361bool(false) 362--- testing: '3.4a' / '65' --- 363float(0.052307692307692) 364--- testing: '3.4a' / '-44' --- 365float(-0.077272727272727) 366--- testing: '3.4a' / '1.2' --- 367float(2.8333333333333) 368--- testing: '3.4a' / '-7.7' --- 369float(-0.44155844155844) 370--- testing: '3.4a' / 'abc' --- 371bool(false) 372--- testing: '3.4a' / '123abc' --- 373float(0.027642276422764) 374--- testing: '3.4a' / '123e5' --- 375float(2.7642276422764E-7) 376--- testing: '3.4a' / '123e5xyz' --- 377float(2.7642276422764E-7) 378--- testing: '3.4a' / ' 123abc' --- 379float(0.027642276422764) 380--- testing: '3.4a' / '123 abc' --- 381float(0.027642276422764) 382--- testing: '3.4a' / '123abc ' --- 383float(0.027642276422764) 384--- testing: '3.4a' / '3.4a' --- 385float(1) 386--- testing: '3.4a' / 'a5.9' --- 387bool(false) 388--- testing: 'a5.9' / '0' --- 389bool(false) 390--- testing: 'a5.9' / '65' --- 391int(0) 392--- testing: 'a5.9' / '-44' --- 393int(0) 394--- testing: 'a5.9' / '1.2' --- 395float(0) 396--- testing: 'a5.9' / '-7.7' --- 397float(-0) 398--- testing: 'a5.9' / 'abc' --- 399bool(false) 400--- testing: 'a5.9' / '123abc' --- 401int(0) 402--- testing: 'a5.9' / '123e5' --- 403float(0) 404--- testing: 'a5.9' / '123e5xyz' --- 405float(0) 406--- testing: 'a5.9' / ' 123abc' --- 407int(0) 408--- testing: 'a5.9' / '123 abc' --- 409int(0) 410--- testing: 'a5.9' / '123abc ' --- 411int(0) 412--- testing: 'a5.9' / '3.4a' --- 413float(0) 414--- testing: 'a5.9' / 'a5.9' --- 415bool(false) 416===DONE=== 417