compare_005_64bit.phpt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. --TEST--
  2. comparing different variables (greater or equal than)
  3. --SKIPIF--
  4. <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
  5. --FILE--
  6. <?php
  7. class test {
  8. }
  9. $a = array(
  10. array(1,2,3),
  11. "",
  12. 1,
  13. 2.5,
  14. 0,
  15. "string",
  16. "123",
  17. "2.5",
  18. NULL,
  19. true,
  20. false,
  21. new stdclass,
  22. new stdclass,
  23. new test,
  24. array(),
  25. -PHP_INT_MAX-1,
  26. (string)(-PHP_INT_MAX-1),
  27. );
  28. $var_cnt = count($a);
  29. function my_dump($var) {
  30. ob_start();
  31. var_dump($var);
  32. $buf = ob_get_clean();
  33. echo str_replace("\n", "", $buf);
  34. }
  35. foreach($a as $var) {
  36. for ($i = 0; $i < $var_cnt; $i++) {
  37. my_dump($var);
  38. echo ($var >= $a[$i]) ? " >= " : " < ";
  39. my_dump($a[$i]);
  40. echo "\n";
  41. }
  42. }
  43. echo "Done\n";
  44. ?>
  45. --EXPECTF--
  46. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  47. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(0) ""
  48. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(1)
  49. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= float(2.5)
  50. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(0)
  51. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(6) "string"
  52. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(3) "123"
  53. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(3) "2.5"
  54. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= NULL
  55. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= bool(true)
  56. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= bool(false)
  57. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(stdClass)#%d (0) {}
  58. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(stdClass)#%d (0) {}
  59. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(test)#%d (0) {}
  60. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= array(0) {}
  61. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(-9223372036854775808)
  62. array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(20) "-9223372036854775808"
  63. string(0) "" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  64. string(0) "" >= string(0) ""
  65. string(0) "" < int(1)
  66. string(0) "" < float(2.5)
  67. string(0) "" < int(0)
  68. string(0) "" < string(6) "string"
  69. string(0) "" < string(3) "123"
  70. string(0) "" < string(3) "2.5"
  71. string(0) "" >= NULL
  72. string(0) "" < bool(true)
  73. string(0) "" >= bool(false)
  74. string(0) "" < object(stdClass)#%d (0) {}
  75. string(0) "" < object(stdClass)#%d (0) {}
  76. string(0) "" < object(test)#%d (0) {}
  77. string(0) "" < array(0) {}
  78. string(0) "" < int(-9223372036854775808)
  79. string(0) "" < string(20) "-9223372036854775808"
  80. int(1) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  81. int(1) >= string(0) ""
  82. int(1) >= int(1)
  83. int(1) < float(2.5)
  84. int(1) >= int(0)
  85. int(1) < string(6) "string"
  86. int(1) < string(3) "123"
  87. int(1) < string(3) "2.5"
  88. int(1) >= NULL
  89. int(1) >= bool(true)
  90. int(1) >= bool(false)
  91. int(1)
  92. Notice: Object of class stdClass could not be converted to int in %s on line %d
  93. >= object(stdClass)#%d (0) {}
  94. int(1)
  95. Notice: Object of class stdClass could not be converted to int in %s on line %d
  96. >= object(stdClass)#%d (0) {}
  97. int(1)
  98. Notice: Object of class test could not be converted to int in %s on line %d
  99. >= object(test)#%d (0) {}
  100. int(1) < array(0) {}
  101. int(1) >= int(-9223372036854775808)
  102. int(1) >= string(20) "-9223372036854775808"
  103. float(2.5) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  104. float(2.5) >= string(0) ""
  105. float(2.5) >= int(1)
  106. float(2.5) >= float(2.5)
  107. float(2.5) >= int(0)
  108. float(2.5) < string(6) "string"
  109. float(2.5) < string(3) "123"
  110. float(2.5) >= string(3) "2.5"
  111. float(2.5) >= NULL
  112. float(2.5) >= bool(true)
  113. float(2.5) >= bool(false)
  114. float(2.5)
  115. Notice: Object of class stdClass could not be converted to float in %s on line %d
  116. >= object(stdClass)#%d (0) {}
  117. float(2.5)
  118. Notice: Object of class stdClass could not be converted to float in %s on line %d
  119. >= object(stdClass)#%d (0) {}
  120. float(2.5)
  121. Notice: Object of class test could not be converted to float in %s on line %d
  122. >= object(test)#%d (0) {}
  123. float(2.5) < array(0) {}
  124. float(2.5) >= int(-9223372036854775808)
  125. float(2.5) >= string(20) "-9223372036854775808"
  126. int(0) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  127. int(0) >= string(0) ""
  128. int(0) < int(1)
  129. int(0) < float(2.5)
  130. int(0) >= int(0)
  131. int(0) < string(6) "string"
  132. int(0) < string(3) "123"
  133. int(0) < string(3) "2.5"
  134. int(0) >= NULL
  135. int(0) < bool(true)
  136. int(0) >= bool(false)
  137. int(0)
  138. Notice: Object of class stdClass could not be converted to int in %s on line %d
  139. < object(stdClass)#%d (0) {}
  140. int(0)
  141. Notice: Object of class stdClass could not be converted to int in %s on line %d
  142. < object(stdClass)#%d (0) {}
  143. int(0)
  144. Notice: Object of class test could not be converted to int in %s on line %d
  145. < object(test)#%d (0) {}
  146. int(0) < array(0) {}
  147. int(0) >= int(-9223372036854775808)
  148. int(0) >= string(20) "-9223372036854775808"
  149. string(6) "string" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  150. string(6) "string" >= string(0) ""
  151. string(6) "string" >= int(1)
  152. string(6) "string" >= float(2.5)
  153. string(6) "string" >= int(0)
  154. string(6) "string" >= string(6) "string"
  155. string(6) "string" >= string(3) "123"
  156. string(6) "string" >= string(3) "2.5"
  157. string(6) "string" >= NULL
  158. string(6) "string" >= bool(true)
  159. string(6) "string" >= bool(false)
  160. string(6) "string" < object(stdClass)#%d (0) {}
  161. string(6) "string" < object(stdClass)#%d (0) {}
  162. string(6) "string" < object(test)#%d (0) {}
  163. string(6) "string" < array(0) {}
  164. string(6) "string" >= int(-9223372036854775808)
  165. string(6) "string" >= string(20) "-9223372036854775808"
  166. string(3) "123" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  167. string(3) "123" >= string(0) ""
  168. string(3) "123" >= int(1)
  169. string(3) "123" >= float(2.5)
  170. string(3) "123" >= int(0)
  171. string(3) "123" < string(6) "string"
  172. string(3) "123" >= string(3) "123"
  173. string(3) "123" >= string(3) "2.5"
  174. string(3) "123" >= NULL
  175. string(3) "123" >= bool(true)
  176. string(3) "123" >= bool(false)
  177. string(3) "123" < object(stdClass)#%d (0) {}
  178. string(3) "123" < object(stdClass)#%d (0) {}
  179. string(3) "123" < object(test)#%d (0) {}
  180. string(3) "123" < array(0) {}
  181. string(3) "123" >= int(-9223372036854775808)
  182. string(3) "123" >= string(20) "-9223372036854775808"
  183. string(3) "2.5" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  184. string(3) "2.5" >= string(0) ""
  185. string(3) "2.5" >= int(1)
  186. string(3) "2.5" >= float(2.5)
  187. string(3) "2.5" >= int(0)
  188. string(3) "2.5" < string(6) "string"
  189. string(3) "2.5" < string(3) "123"
  190. string(3) "2.5" >= string(3) "2.5"
  191. string(3) "2.5" >= NULL
  192. string(3) "2.5" >= bool(true)
  193. string(3) "2.5" >= bool(false)
  194. string(3) "2.5" < object(stdClass)#%d (0) {}
  195. string(3) "2.5" < object(stdClass)#%d (0) {}
  196. string(3) "2.5" < object(test)#%d (0) {}
  197. string(3) "2.5" < array(0) {}
  198. string(3) "2.5" >= int(-9223372036854775808)
  199. string(3) "2.5" >= string(20) "-9223372036854775808"
  200. NULL < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  201. NULL >= string(0) ""
  202. NULL < int(1)
  203. NULL < float(2.5)
  204. NULL >= int(0)
  205. NULL < string(6) "string"
  206. NULL < string(3) "123"
  207. NULL < string(3) "2.5"
  208. NULL >= NULL
  209. NULL < bool(true)
  210. NULL >= bool(false)
  211. NULL < object(stdClass)#%d (0) {}
  212. NULL < object(stdClass)#%d (0) {}
  213. NULL < object(test)#%d (0) {}
  214. NULL >= array(0) {}
  215. NULL < int(-9223372036854775808)
  216. NULL < string(20) "-9223372036854775808"
  217. bool(true) >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  218. bool(true) >= string(0) ""
  219. bool(true) >= int(1)
  220. bool(true) >= float(2.5)
  221. bool(true) >= int(0)
  222. bool(true) >= string(6) "string"
  223. bool(true) >= string(3) "123"
  224. bool(true) >= string(3) "2.5"
  225. bool(true) >= NULL
  226. bool(true) >= bool(true)
  227. bool(true) >= bool(false)
  228. bool(true) >= object(stdClass)#%d (0) {}
  229. bool(true) >= object(stdClass)#%d (0) {}
  230. bool(true) >= object(test)#%d (0) {}
  231. bool(true) >= array(0) {}
  232. bool(true) >= int(-9223372036854775808)
  233. bool(true) >= string(20) "-9223372036854775808"
  234. bool(false) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  235. bool(false) >= string(0) ""
  236. bool(false) < int(1)
  237. bool(false) < float(2.5)
  238. bool(false) >= int(0)
  239. bool(false) < string(6) "string"
  240. bool(false) < string(3) "123"
  241. bool(false) < string(3) "2.5"
  242. bool(false) >= NULL
  243. bool(false) < bool(true)
  244. bool(false) >= bool(false)
  245. bool(false) < object(stdClass)#%d (0) {}
  246. bool(false) < object(stdClass)#%d (0) {}
  247. bool(false) < object(test)#%d (0) {}
  248. bool(false) >= array(0) {}
  249. bool(false) < int(-9223372036854775808)
  250. bool(false) < string(20) "-9223372036854775808"
  251. object(stdClass)#%d (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  252. object(stdClass)#%d (0) {} >= string(0) ""
  253. object(stdClass)#%d (0) {}
  254. Notice: Object of class stdClass could not be converted to int in %s on line %d
  255. >= int(1)
  256. object(stdClass)#%d (0) {}
  257. Notice: Object of class stdClass could not be converted to float in %s on line %d
  258. < float(2.5)
  259. object(stdClass)#%d (0) {}
  260. Notice: Object of class stdClass could not be converted to int in %s on line %d
  261. >= int(0)
  262. object(stdClass)#%d (0) {} >= string(6) "string"
  263. object(stdClass)#%d (0) {} >= string(3) "123"
  264. object(stdClass)#%d (0) {} >= string(3) "2.5"
  265. object(stdClass)#%d (0) {} >= NULL
  266. object(stdClass)#%d (0) {} >= bool(true)
  267. object(stdClass)#%d (0) {} >= bool(false)
  268. object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {}
  269. object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {}
  270. object(stdClass)#%d (0) {} < object(test)#%d (0) {}
  271. object(stdClass)#%d (0) {} >= array(0) {}
  272. object(stdClass)#%d (0) {}
  273. Notice: Object of class stdClass could not be converted to int in %s on line %d
  274. >= int(-9223372036854775808)
  275. object(stdClass)#%d (0) {} >= string(20) "-9223372036854775808"
  276. object(stdClass)#%d (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  277. object(stdClass)#%d (0) {} >= string(0) ""
  278. object(stdClass)#%d (0) {}
  279. Notice: Object of class stdClass could not be converted to int in %s on line %d
  280. >= int(1)
  281. object(stdClass)#%d (0) {}
  282. Notice: Object of class stdClass could not be converted to float in %s on line %d
  283. < float(2.5)
  284. object(stdClass)#%d (0) {}
  285. Notice: Object of class stdClass could not be converted to int in %s on line %d
  286. >= int(0)
  287. object(stdClass)#%d (0) {} >= string(6) "string"
  288. object(stdClass)#%d (0) {} >= string(3) "123"
  289. object(stdClass)#%d (0) {} >= string(3) "2.5"
  290. object(stdClass)#%d (0) {} >= NULL
  291. object(stdClass)#%d (0) {} >= bool(true)
  292. object(stdClass)#%d (0) {} >= bool(false)
  293. object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {}
  294. object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {}
  295. object(stdClass)#%d (0) {} < object(test)#%d (0) {}
  296. object(stdClass)#%d (0) {} >= array(0) {}
  297. object(stdClass)#%d (0) {}
  298. Notice: Object of class stdClass could not be converted to int in %s on line %d
  299. >= int(-9223372036854775808)
  300. object(stdClass)#%d (0) {} >= string(20) "-9223372036854775808"
  301. object(test)#%d (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  302. object(test)#%d (0) {} >= string(0) ""
  303. object(test)#%d (0) {}
  304. Notice: Object of class test could not be converted to int in %s on line %d
  305. >= int(1)
  306. object(test)#%d (0) {}
  307. Notice: Object of class test could not be converted to float in %s on line %d
  308. < float(2.5)
  309. object(test)#%d (0) {}
  310. Notice: Object of class test could not be converted to int in %s on line %d
  311. >= int(0)
  312. object(test)#%d (0) {} >= string(6) "string"
  313. object(test)#%d (0) {} >= string(3) "123"
  314. object(test)#%d (0) {} >= string(3) "2.5"
  315. object(test)#%d (0) {} >= NULL
  316. object(test)#%d (0) {} >= bool(true)
  317. object(test)#%d (0) {} >= bool(false)
  318. object(test)#%d (0) {} < object(stdClass)#%d (0) {}
  319. object(test)#%d (0) {} < object(stdClass)#%d (0) {}
  320. object(test)#%d (0) {} >= object(test)#%d (0) {}
  321. object(test)#%d (0) {} >= array(0) {}
  322. object(test)#%d (0) {}
  323. Notice: Object of class test could not be converted to int in %s on line %d
  324. >= int(-9223372036854775808)
  325. object(test)#%d (0) {} >= string(20) "-9223372036854775808"
  326. array(0) {} < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  327. array(0) {} >= string(0) ""
  328. array(0) {} >= int(1)
  329. array(0) {} >= float(2.5)
  330. array(0) {} >= int(0)
  331. array(0) {} >= string(6) "string"
  332. array(0) {} >= string(3) "123"
  333. array(0) {} >= string(3) "2.5"
  334. array(0) {} >= NULL
  335. array(0) {} < bool(true)
  336. array(0) {} >= bool(false)
  337. array(0) {} < object(stdClass)#%d (0) {}
  338. array(0) {} < object(stdClass)#%d (0) {}
  339. array(0) {} < object(test)#%d (0) {}
  340. array(0) {} >= array(0) {}
  341. array(0) {} >= int(-9223372036854775808)
  342. array(0) {} >= string(20) "-9223372036854775808"
  343. int(-9223372036854775808) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  344. int(-9223372036854775808) >= string(0) ""
  345. int(-9223372036854775808) < int(1)
  346. int(-9223372036854775808) < float(2.5)
  347. int(-9223372036854775808) < int(0)
  348. int(-9223372036854775808) < string(6) "string"
  349. int(-9223372036854775808) < string(3) "123"
  350. int(-9223372036854775808) < string(3) "2.5"
  351. int(-9223372036854775808) >= NULL
  352. int(-9223372036854775808) >= bool(true)
  353. int(-9223372036854775808) >= bool(false)
  354. int(-9223372036854775808)
  355. Notice: Object of class stdClass could not be converted to int in %s on line %d
  356. < object(stdClass)#%d (0) {}
  357. int(-9223372036854775808)
  358. Notice: Object of class stdClass could not be converted to int in %s on line %d
  359. < object(stdClass)#%d (0) {}
  360. int(-9223372036854775808)
  361. Notice: Object of class test could not be converted to int in %s on line %d
  362. < object(test)#%d (0) {}
  363. int(-9223372036854775808) < array(0) {}
  364. int(-9223372036854775808) >= int(-9223372036854775808)
  365. int(-9223372036854775808) >= string(20) "-9223372036854775808"
  366. string(20) "-9223372036854775808" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
  367. string(20) "-9223372036854775808" >= string(0) ""
  368. string(20) "-9223372036854775808" < int(1)
  369. string(20) "-9223372036854775808" < float(2.5)
  370. string(20) "-9223372036854775808" < int(0)
  371. string(20) "-9223372036854775808" < string(6) "string"
  372. string(20) "-9223372036854775808" < string(3) "123"
  373. string(20) "-9223372036854775808" < string(3) "2.5"
  374. string(20) "-9223372036854775808" >= NULL
  375. string(20) "-9223372036854775808" >= bool(true)
  376. string(20) "-9223372036854775808" >= bool(false)
  377. string(20) "-9223372036854775808" < object(stdClass)#%d (0) {}
  378. string(20) "-9223372036854775808" < object(stdClass)#%d (0) {}
  379. string(20) "-9223372036854775808" < object(test)#%d (0) {}
  380. string(20) "-9223372036854775808" < array(0) {}
  381. string(20) "-9223372036854775808" >= int(-9223372036854775808)
  382. string(20) "-9223372036854775808" >= string(20) "-9223372036854775808"
  383. Done