multiply_variationStr.phpt 11 KB

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