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