strcmp.phpt 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. --TEST--
  2. strcmp() function
  3. --INI--
  4. precision = 12
  5. --FILE--
  6. <?php
  7. /* Compares two strings in case-sensitive manner */
  8. echo "#### Basic and Possible operations ####";
  9. /* creating an array of strings to be compared */
  10. $arrays = array(
  11. array("a", "A", 'a', 'A', chr(128), chr(255), chr(256)),
  12. array("acc", "Acc", 'ac', "accc", 'acd', "?acc", 'acc!', "$!acc", ";acc"),
  13. array("1", "0", 0, "-1", -1, NULL, "", TRUE, FALSE, "string"),
  14. array(10.5, 1.5, 9.5, 11.5, 100.5, 10.5E1, -10.5, 10, 0.5)
  15. );
  16. /* loop through to go each and every element in an array
  17. and comparing the elements with one and other */
  18. foreach($arrays as $str1_arr){
  19. echo "\n*** comparing the strings in an \n";
  20. print_r($str1_arr);
  21. for ($i=0; $i<count($str1_arr); $i++){
  22. echo "\nIteration $i\n";
  23. for($j=0; $j<count($str1_arr); $j++){
  24. echo "- strcmp of '$str1_arr[$i]' and '$str1_arr[$j]' is => ";
  25. var_dump(strcmp($str1_arr[$i], $str1_arr[$j]));
  26. }
  27. }
  28. }
  29. echo "\n#### Testing Miscelleneous inputs ####\n";
  30. echo "--- Testing objects ---\n";
  31. /* we get "Catchable fatal error: saying Object of class could not be converted
  32. to string" by default, when an object is passed instead of string.
  33. The error can be avoided by choosing the __toString magix method as follows: */
  34. class string1 {
  35. function __toString() {
  36. return "Hello, world";
  37. }
  38. }
  39. $obj_string1 = new string1;
  40. class string2 {
  41. function __toString() {
  42. return "Hello, world\0";
  43. }
  44. }
  45. $obj_string2 = new string2;
  46. var_dump(strcmp("$obj_string1", "$obj_string2"));
  47. echo "\n--- Testing arrays ---\n";
  48. $str_arr = array("hello", "?world", "!$%**()%**[][[[&@#~!");
  49. var_dump(strcmp("hello?world,!$%**()%**[][[[&@#~!", $str_arr));
  50. var_dump(strcmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[1]"));
  51. var_dump(strcmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[2]"));
  52. echo "\n--- Testing Resources ---\n";
  53. $filename1 = "dummy.txt";
  54. $filename2 = "dummy1.txt";
  55. $file1 = fopen($filename1, "w"); // creating new file
  56. $file2 = fopen($filename2, "w"); // creating new file
  57. /* getting resource type for file handle */
  58. $string1 = get_resource_type($file1);
  59. $string2 = get_resource_type($file2);
  60. $string3 = (int)get_resource_type($file2);
  61. /* string1 and string2 of same "stream" type */
  62. var_dump(strcmp($string1, $string2)); // int(0)
  63. /* string1 is of "stream" type & string3 is of "int" type */
  64. var_dump(strcmp($string1, $string3)); // int(1)
  65. fclose($file1); // closing the file "dummy.txt"
  66. fclose($file2); // closing the file "dummy1.txt"
  67. unlink("$filename1"); // deletes "dummy.txt"
  68. unlink("$filename2"); // deletes "dummy1.txt"
  69. echo "\n--- Testing a longer and heredoc string ---\n";
  70. $string = <<<EOD
  71. abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
  72. abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
  73. abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
  74. abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
  75. abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
  76. abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
  77. abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
  78. @#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
  79. abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
  80. EOD;
  81. var_dump(strcmp($string, $string));
  82. var_dump(strcmp($string, "xyz0123456789"));
  83. var_dump(strcmp($string, "&&&"));
  84. echo "\n--- Testing a heredoc null string ---\n";
  85. $str = <<<EOD
  86. EOD;
  87. var_dump(strcmp($str, "\0"));
  88. var_dump(strcmp($str, NULL));
  89. var_dump(strcmp($str, "0"));
  90. echo "\n--- Testing simple and complex syntax strings ---\n";
  91. $str = 'world';
  92. /* Simple syntax */
  93. var_dump(strcmp("Hello, world", "$str"));
  94. var_dump(strcmp("Hello, world'S", "$str'S"));
  95. var_dump(strcmp("Hello, worldS", "$strS"));
  96. /* String with curly braces, complex syntax */
  97. var_dump(strcmp("Hello, worldS", "${str}S"));
  98. var_dump(strcmp("Hello, worldS", "{$str}S"));
  99. echo "\n--- Testing binary safe and binary chars ---\n";
  100. var_dump(strcmp("Hello\0world", "Hello"));
  101. var_dump(strcmp("Hello\0world", "Helloworld"));
  102. var_dump(strcmp("\x0", "\0"));
  103. var_dump(strcmp("\000", "\0"));
  104. var_dump(strcmp("\x00", ""));
  105. var_dump(strcmp("\x00", NULL));
  106. var_dump(strcmp("\000", NULL));
  107. echo "\n--- Comparing long float values ---\n";
  108. /* Here two different outputs, which depends on the rounding value
  109. before converting to string. Here Precision = 12 */
  110. var_dump(strcmp(10.55555555555555555555555555, 10.5555555556)); // int(0)
  111. var_dump(strcmp(10.55555555555555555555555555, 10.555555556)); // int(-1)
  112. var_dump(strcmp(10.55555555595555555555555555, 10.555555556)); // int(0)
  113. echo "\n#### checking error conditions ####";
  114. strcmp();
  115. strcmp("");
  116. strcmp("HI");
  117. strcmp("Hi", "Hello", "World");
  118. echo "Done\n";
  119. ?>
  120. --EXPECTF--
  121. #### Basic and Possible operations ####
  122. *** comparing the strings in an
  123. Array
  124. (
  125. [0] => a
  126. [1] => A
  127. [2] => a
  128. [3] => A
  129. [4] => €
  130. [5] => ÿ
  131. [6] => �
  132. )
  133. Iteration 0
  134. - strcmp of 'a' and 'a' is => int(0)
  135. - strcmp of 'a' and 'A' is => int(%d)
  136. - strcmp of 'a' and 'a' is => int(0)
  137. - strcmp of 'a' and 'A' is => int(%d)
  138. - strcmp of 'a' and '€' is => int(-%d)
  139. - strcmp of 'a' and 'ÿ' is => int(-%d)
  140. - strcmp of 'a' and '�' is => int(%d)
  141. Iteration 1
  142. - strcmp of 'A' and 'a' is => int(-%d)
  143. - strcmp of 'A' and 'A' is => int(0)
  144. - strcmp of 'A' and 'a' is => int(-%d)
  145. - strcmp of 'A' and 'A' is => int(0)
  146. - strcmp of 'A' and '€' is => int(-%d)
  147. - strcmp of 'A' and 'ÿ' is => int(-%d)
  148. - strcmp of 'A' and '�' is => int(%d)
  149. Iteration 2
  150. - strcmp of 'a' and 'a' is => int(0)
  151. - strcmp of 'a' and 'A' is => int(%d)
  152. - strcmp of 'a' and 'a' is => int(0)
  153. - strcmp of 'a' and 'A' is => int(%d)
  154. - strcmp of 'a' and '€' is => int(-%d)
  155. - strcmp of 'a' and 'ÿ' is => int(-%d)
  156. - strcmp of 'a' and '�' is => int(%d)
  157. Iteration 3
  158. - strcmp of 'A' and 'a' is => int(-%d)
  159. - strcmp of 'A' and 'A' is => int(0)
  160. - strcmp of 'A' and 'a' is => int(-%d)
  161. - strcmp of 'A' and 'A' is => int(0)
  162. - strcmp of 'A' and '€' is => int(-%d)
  163. - strcmp of 'A' and 'ÿ' is => int(-%d)
  164. - strcmp of 'A' and '�' is => int(%d)
  165. Iteration 4
  166. - strcmp of '€' and 'a' is => int(%d)
  167. - strcmp of '€' and 'A' is => int(%d)
  168. - strcmp of '€' and 'a' is => int(%d)
  169. - strcmp of '€' and 'A' is => int(%d)
  170. - strcmp of '€' and '€' is => int(0)
  171. - strcmp of '€' and 'ÿ' is => int(-%d)
  172. - strcmp of '€' and '�' is => int(%d)
  173. Iteration 5
  174. - strcmp of 'ÿ' and 'a' is => int(%d)
  175. - strcmp of 'ÿ' and 'A' is => int(%d)
  176. - strcmp of 'ÿ' and 'a' is => int(%d)
  177. - strcmp of 'ÿ' and 'A' is => int(%d)
  178. - strcmp of 'ÿ' and '€' is => int(%d)
  179. - strcmp of 'ÿ' and 'ÿ' is => int(0)
  180. - strcmp of 'ÿ' and '�' is => int(%d)
  181. Iteration 6
  182. - strcmp of '�' and 'a' is => int(-%d)
  183. - strcmp of '�' and 'A' is => int(-%d)
  184. - strcmp of '�' and 'a' is => int(-%d)
  185. - strcmp of '�' and 'A' is => int(-%d)
  186. - strcmp of '�' and '€' is => int(-%d)
  187. - strcmp of '�' and 'ÿ' is => int(-%d)
  188. - strcmp of '�' and '�' is => int(0)
  189. *** comparing the strings in an
  190. Array
  191. (
  192. [0] => acc
  193. [1] => Acc
  194. [2] => ac
  195. [3] => accc
  196. [4] => acd
  197. [5] => ?acc
  198. [6] => acc!
  199. [7] => $!acc
  200. [8] => ;acc
  201. )
  202. Iteration 0
  203. - strcmp of 'acc' and 'acc' is => int(0)
  204. - strcmp of 'acc' and 'Acc' is => int(%d)
  205. - strcmp of 'acc' and 'ac' is => int(%d)
  206. - strcmp of 'acc' and 'accc' is => int(-%d)
  207. - strcmp of 'acc' and 'acd' is => int(-%d)
  208. - strcmp of 'acc' and '?acc' is => int(%d)
  209. - strcmp of 'acc' and 'acc!' is => int(-%d)
  210. - strcmp of 'acc' and '$!acc' is => int(%d)
  211. - strcmp of 'acc' and ';acc' is => int(%d)
  212. Iteration 1
  213. - strcmp of 'Acc' and 'acc' is => int(-%d)
  214. - strcmp of 'Acc' and 'Acc' is => int(0)
  215. - strcmp of 'Acc' and 'ac' is => int(-%d)
  216. - strcmp of 'Acc' and 'accc' is => int(-%d)
  217. - strcmp of 'Acc' and 'acd' is => int(-%d)
  218. - strcmp of 'Acc' and '?acc' is => int(%d)
  219. - strcmp of 'Acc' and 'acc!' is => int(-%d)
  220. - strcmp of 'Acc' and '$!acc' is => int(%d)
  221. - strcmp of 'Acc' and ';acc' is => int(%d)
  222. Iteration 2
  223. - strcmp of 'ac' and 'acc' is => int(-%d)
  224. - strcmp of 'ac' and 'Acc' is => int(%d)
  225. - strcmp of 'ac' and 'ac' is => int(0)
  226. - strcmp of 'ac' and 'accc' is => int(-%d)
  227. - strcmp of 'ac' and 'acd' is => int(-%d)
  228. - strcmp of 'ac' and '?acc' is => int(%d)
  229. - strcmp of 'ac' and 'acc!' is => int(-%d)
  230. - strcmp of 'ac' and '$!acc' is => int(%d)
  231. - strcmp of 'ac' and ';acc' is => int(%d)
  232. Iteration 3
  233. - strcmp of 'accc' and 'acc' is => int(%d)
  234. - strcmp of 'accc' and 'Acc' is => int(%d)
  235. - strcmp of 'accc' and 'ac' is => int(%d)
  236. - strcmp of 'accc' and 'accc' is => int(0)
  237. - strcmp of 'accc' and 'acd' is => int(-%d)
  238. - strcmp of 'accc' and '?acc' is => int(%d)
  239. - strcmp of 'accc' and 'acc!' is => int(%d)
  240. - strcmp of 'accc' and '$!acc' is => int(%d)
  241. - strcmp of 'accc' and ';acc' is => int(%d)
  242. Iteration 4
  243. - strcmp of 'acd' and 'acc' is => int(%d)
  244. - strcmp of 'acd' and 'Acc' is => int(%d)
  245. - strcmp of 'acd' and 'ac' is => int(%d)
  246. - strcmp of 'acd' and 'accc' is => int(%d)
  247. - strcmp of 'acd' and 'acd' is => int(0)
  248. - strcmp of 'acd' and '?acc' is => int(%d)
  249. - strcmp of 'acd' and 'acc!' is => int(%d)
  250. - strcmp of 'acd' and '$!acc' is => int(%d)
  251. - strcmp of 'acd' and ';acc' is => int(%d)
  252. Iteration 5
  253. - strcmp of '?acc' and 'acc' is => int(-%d)
  254. - strcmp of '?acc' and 'Acc' is => int(-%d)
  255. - strcmp of '?acc' and 'ac' is => int(-%d)
  256. - strcmp of '?acc' and 'accc' is => int(-%d)
  257. - strcmp of '?acc' and 'acd' is => int(-%d)
  258. - strcmp of '?acc' and '?acc' is => int(0)
  259. - strcmp of '?acc' and 'acc!' is => int(-%d)
  260. - strcmp of '?acc' and '$!acc' is => int(%d)
  261. - strcmp of '?acc' and ';acc' is => int(%d)
  262. Iteration 6
  263. - strcmp of 'acc!' and 'acc' is => int(%d)
  264. - strcmp of 'acc!' and 'Acc' is => int(%d)
  265. - strcmp of 'acc!' and 'ac' is => int(%d)
  266. - strcmp of 'acc!' and 'accc' is => int(-%d)
  267. - strcmp of 'acc!' and 'acd' is => int(-%d)
  268. - strcmp of 'acc!' and '?acc' is => int(%d)
  269. - strcmp of 'acc!' and 'acc!' is => int(0)
  270. - strcmp of 'acc!' and '$!acc' is => int(%d)
  271. - strcmp of 'acc!' and ';acc' is => int(%d)
  272. Iteration 7
  273. - strcmp of '$!acc' and 'acc' is => int(-%d)
  274. - strcmp of '$!acc' and 'Acc' is => int(-%d)
  275. - strcmp of '$!acc' and 'ac' is => int(-%d)
  276. - strcmp of '$!acc' and 'accc' is => int(-%d)
  277. - strcmp of '$!acc' and 'acd' is => int(-%d)
  278. - strcmp of '$!acc' and '?acc' is => int(-%d)
  279. - strcmp of '$!acc' and 'acc!' is => int(-%d)
  280. - strcmp of '$!acc' and '$!acc' is => int(0)
  281. - strcmp of '$!acc' and ';acc' is => int(-%d)
  282. Iteration 8
  283. - strcmp of ';acc' and 'acc' is => int(-%d)
  284. - strcmp of ';acc' and 'Acc' is => int(-%d)
  285. - strcmp of ';acc' and 'ac' is => int(-%d)
  286. - strcmp of ';acc' and 'accc' is => int(-%d)
  287. - strcmp of ';acc' and 'acd' is => int(-%d)
  288. - strcmp of ';acc' and '?acc' is => int(-%d)
  289. - strcmp of ';acc' and 'acc!' is => int(-%d)
  290. - strcmp of ';acc' and '$!acc' is => int(%d)
  291. - strcmp of ';acc' and ';acc' is => int(0)
  292. *** comparing the strings in an
  293. Array
  294. (
  295. [0] => 1
  296. [1] => 0
  297. [2] => 0
  298. [3] => -1
  299. [4] => -1
  300. [5] =>
  301. [6] =>
  302. [7] => 1
  303. [8] =>
  304. [9] => string
  305. )
  306. Iteration 0
  307. - strcmp of '1' and '1' is => int(0)
  308. - strcmp of '1' and '0' is => int(%d)
  309. - strcmp of '1' and '0' is => int(%d)
  310. - strcmp of '1' and '-1' is => int(%d)
  311. - strcmp of '1' and '-1' is => int(%d)
  312. - strcmp of '1' and '' is => int(%d)
  313. - strcmp of '1' and '' is => int(%d)
  314. - strcmp of '1' and '1' is => int(0)
  315. - strcmp of '1' and '' is => int(%d)
  316. - strcmp of '1' and 'string' is => int(-%d)
  317. Iteration 1
  318. - strcmp of '0' and '1' is => int(-%d)
  319. - strcmp of '0' and '0' is => int(0)
  320. - strcmp of '0' and '0' is => int(0)
  321. - strcmp of '0' and '-1' is => int(%d)
  322. - strcmp of '0' and '-1' is => int(%d)
  323. - strcmp of '0' and '' is => int(%d)
  324. - strcmp of '0' and '' is => int(%d)
  325. - strcmp of '0' and '1' is => int(-%d)
  326. - strcmp of '0' and '' is => int(%d)
  327. - strcmp of '0' and 'string' is => int(-%d)
  328. Iteration 2
  329. - strcmp of '0' and '1' is => int(-%d)
  330. - strcmp of '0' and '0' is => int(0)
  331. - strcmp of '0' and '0' is => int(0)
  332. - strcmp of '0' and '-1' is => int(%d)
  333. - strcmp of '0' and '-1' is => int(%d)
  334. - strcmp of '0' and '' is => int(%d)
  335. - strcmp of '0' and '' is => int(%d)
  336. - strcmp of '0' and '1' is => int(-%d)
  337. - strcmp of '0' and '' is => int(%d)
  338. - strcmp of '0' and 'string' is => int(-%d)
  339. Iteration 3
  340. - strcmp of '-1' and '1' is => int(-%d)
  341. - strcmp of '-1' and '0' is => int(-%d)
  342. - strcmp of '-1' and '0' is => int(-%d)
  343. - strcmp of '-1' and '-1' is => int(0)
  344. - strcmp of '-1' and '-1' is => int(0)
  345. - strcmp of '-1' and '' is => int(%d)
  346. - strcmp of '-1' and '' is => int(%d)
  347. - strcmp of '-1' and '1' is => int(-%d)
  348. - strcmp of '-1' and '' is => int(%d)
  349. - strcmp of '-1' and 'string' is => int(-%d)
  350. Iteration 4
  351. - strcmp of '-1' and '1' is => int(-%d)
  352. - strcmp of '-1' and '0' is => int(-%d)
  353. - strcmp of '-1' and '0' is => int(-%d)
  354. - strcmp of '-1' and '-1' is => int(0)
  355. - strcmp of '-1' and '-1' is => int(0)
  356. - strcmp of '-1' and '' is => int(%d)
  357. - strcmp of '-1' and '' is => int(%d)
  358. - strcmp of '-1' and '1' is => int(-%d)
  359. - strcmp of '-1' and '' is => int(%d)
  360. - strcmp of '-1' and 'string' is => int(-%d)
  361. Iteration 5
  362. - strcmp of '' and '1' is => int(-%d)
  363. - strcmp of '' and '0' is => int(-%d)
  364. - strcmp of '' and '0' is => int(-%d)
  365. - strcmp of '' and '-1' is => int(-%d)
  366. - strcmp of '' and '-1' is => int(-%d)
  367. - strcmp of '' and '' is => int(0)
  368. - strcmp of '' and '' is => int(0)
  369. - strcmp of '' and '1' is => int(-%d)
  370. - strcmp of '' and '' is => int(0)
  371. - strcmp of '' and 'string' is => int(-%d)
  372. Iteration 6
  373. - strcmp of '' and '1' is => int(-%d)
  374. - strcmp of '' and '0' is => int(-%d)
  375. - strcmp of '' and '0' is => int(-%d)
  376. - strcmp of '' and '-1' is => int(-%d)
  377. - strcmp of '' and '-1' is => int(-%d)
  378. - strcmp of '' and '' is => int(0)
  379. - strcmp of '' and '' is => int(0)
  380. - strcmp of '' and '1' is => int(-%d)
  381. - strcmp of '' and '' is => int(0)
  382. - strcmp of '' and 'string' is => int(-%d)
  383. Iteration 7
  384. - strcmp of '1' and '1' is => int(0)
  385. - strcmp of '1' and '0' is => int(%d)
  386. - strcmp of '1' and '0' is => int(%d)
  387. - strcmp of '1' and '-1' is => int(%d)
  388. - strcmp of '1' and '-1' is => int(%d)
  389. - strcmp of '1' and '' is => int(%d)
  390. - strcmp of '1' and '' is => int(%d)
  391. - strcmp of '1' and '1' is => int(0)
  392. - strcmp of '1' and '' is => int(%d)
  393. - strcmp of '1' and 'string' is => int(-%d)
  394. Iteration 8
  395. - strcmp of '' and '1' is => int(-%d)
  396. - strcmp of '' and '0' is => int(-%d)
  397. - strcmp of '' and '0' is => int(-%d)
  398. - strcmp of '' and '-1' is => int(-%d)
  399. - strcmp of '' and '-1' is => int(-%d)
  400. - strcmp of '' and '' is => int(0)
  401. - strcmp of '' and '' is => int(0)
  402. - strcmp of '' and '1' is => int(-%d)
  403. - strcmp of '' and '' is => int(0)
  404. - strcmp of '' and 'string' is => int(-%d)
  405. Iteration 9
  406. - strcmp of 'string' and '1' is => int(%d)
  407. - strcmp of 'string' and '0' is => int(%d)
  408. - strcmp of 'string' and '0' is => int(%d)
  409. - strcmp of 'string' and '-1' is => int(%d)
  410. - strcmp of 'string' and '-1' is => int(%d)
  411. - strcmp of 'string' and '' is => int(%d)
  412. - strcmp of 'string' and '' is => int(%d)
  413. - strcmp of 'string' and '1' is => int(%d)
  414. - strcmp of 'string' and '' is => int(%d)
  415. - strcmp of 'string' and 'string' is => int(0)
  416. *** comparing the strings in an
  417. Array
  418. (
  419. [0] => 10.5
  420. [1] => 1.5
  421. [2] => 9.5
  422. [3] => 11.5
  423. [4] => 100.5
  424. [5] => 105
  425. [6] => -10.5
  426. [7] => 10
  427. [8] => 0.5
  428. )
  429. Iteration 0
  430. - strcmp of '10.5' and '10.5' is => int(0)
  431. - strcmp of '10.5' and '1.5' is => int(%d)
  432. - strcmp of '10.5' and '9.5' is => int(-%d)
  433. - strcmp of '10.5' and '11.5' is => int(-%d)
  434. - strcmp of '10.5' and '100.5' is => int(-%d)
  435. - strcmp of '10.5' and '105' is => int(-%d)
  436. - strcmp of '10.5' and '-10.5' is => int(%d)
  437. - strcmp of '10.5' and '10' is => int(%d)
  438. - strcmp of '10.5' and '0.5' is => int(%d)
  439. Iteration 1
  440. - strcmp of '1.5' and '10.5' is => int(-%d)
  441. - strcmp of '1.5' and '1.5' is => int(0)
  442. - strcmp of '1.5' and '9.5' is => int(-%d)
  443. - strcmp of '1.5' and '11.5' is => int(-%d)
  444. - strcmp of '1.5' and '100.5' is => int(-%d)
  445. - strcmp of '1.5' and '105' is => int(-%d)
  446. - strcmp of '1.5' and '-10.5' is => int(%d)
  447. - strcmp of '1.5' and '10' is => int(-%d)
  448. - strcmp of '1.5' and '0.5' is => int(%d)
  449. Iteration 2
  450. - strcmp of '9.5' and '10.5' is => int(%d)
  451. - strcmp of '9.5' and '1.5' is => int(%d)
  452. - strcmp of '9.5' and '9.5' is => int(0)
  453. - strcmp of '9.5' and '11.5' is => int(%d)
  454. - strcmp of '9.5' and '100.5' is => int(%d)
  455. - strcmp of '9.5' and '105' is => int(%d)
  456. - strcmp of '9.5' and '-10.5' is => int(%d)
  457. - strcmp of '9.5' and '10' is => int(%d)
  458. - strcmp of '9.5' and '0.5' is => int(%d)
  459. Iteration 3
  460. - strcmp of '11.5' and '10.5' is => int(%d)
  461. - strcmp of '11.5' and '1.5' is => int(%d)
  462. - strcmp of '11.5' and '9.5' is => int(-%d)
  463. - strcmp of '11.5' and '11.5' is => int(0)
  464. - strcmp of '11.5' and '100.5' is => int(%d)
  465. - strcmp of '11.5' and '105' is => int(%d)
  466. - strcmp of '11.5' and '-10.5' is => int(%d)
  467. - strcmp of '11.5' and '10' is => int(%d)
  468. - strcmp of '11.5' and '0.5' is => int(%d)
  469. Iteration 4
  470. - strcmp of '100.5' and '10.5' is => int(%d)
  471. - strcmp of '100.5' and '1.5' is => int(%d)
  472. - strcmp of '100.5' and '9.5' is => int(-%d)
  473. - strcmp of '100.5' and '11.5' is => int(-%d)
  474. - strcmp of '100.5' and '100.5' is => int(0)
  475. - strcmp of '100.5' and '105' is => int(-%d)
  476. - strcmp of '100.5' and '-10.5' is => int(%d)
  477. - strcmp of '100.5' and '10' is => int(%d)
  478. - strcmp of '100.5' and '0.5' is => int(%d)
  479. Iteration 5
  480. - strcmp of '105' and '10.5' is => int(%d)
  481. - strcmp of '105' and '1.5' is => int(%d)
  482. - strcmp of '105' and '9.5' is => int(-%d)
  483. - strcmp of '105' and '11.5' is => int(-%d)
  484. - strcmp of '105' and '100.5' is => int(%d)
  485. - strcmp of '105' and '105' is => int(0)
  486. - strcmp of '105' and '-10.5' is => int(%d)
  487. - strcmp of '105' and '10' is => int(%d)
  488. - strcmp of '105' and '0.5' is => int(%d)
  489. Iteration 6
  490. - strcmp of '-10.5' and '10.5' is => int(-%d)
  491. - strcmp of '-10.5' and '1.5' is => int(-%d)
  492. - strcmp of '-10.5' and '9.5' is => int(-%d)
  493. - strcmp of '-10.5' and '11.5' is => int(-%d)
  494. - strcmp of '-10.5' and '100.5' is => int(-%d)
  495. - strcmp of '-10.5' and '105' is => int(-%d)
  496. - strcmp of '-10.5' and '-10.5' is => int(0)
  497. - strcmp of '-10.5' and '10' is => int(-%d)
  498. - strcmp of '-10.5' and '0.5' is => int(-%d)
  499. Iteration 7
  500. - strcmp of '10' and '10.5' is => int(-%d)
  501. - strcmp of '10' and '1.5' is => int(%d)
  502. - strcmp of '10' and '9.5' is => int(-%d)
  503. - strcmp of '10' and '11.5' is => int(-%d)
  504. - strcmp of '10' and '100.5' is => int(-%d)
  505. - strcmp of '10' and '105' is => int(-%d)
  506. - strcmp of '10' and '-10.5' is => int(%d)
  507. - strcmp of '10' and '10' is => int(0)
  508. - strcmp of '10' and '0.5' is => int(%d)
  509. Iteration 8
  510. - strcmp of '0.5' and '10.5' is => int(-%d)
  511. - strcmp of '0.5' and '1.5' is => int(-%d)
  512. - strcmp of '0.5' and '9.5' is => int(-%d)
  513. - strcmp of '0.5' and '11.5' is => int(-%d)
  514. - strcmp of '0.5' and '100.5' is => int(-%d)
  515. - strcmp of '0.5' and '105' is => int(-%d)
  516. - strcmp of '0.5' and '-10.5' is => int(%d)
  517. - strcmp of '0.5' and '10' is => int(-%d)
  518. - strcmp of '0.5' and '0.5' is => int(0)
  519. #### Testing Miscelleneous inputs ####
  520. --- Testing objects ---
  521. int(-%d)
  522. --- Testing arrays ---
  523. Warning: strcmp() expects parameter 2 to be string, array given in %s on line %d
  524. NULL
  525. int(%d)
  526. int(%d)
  527. --- Testing Resources ---
  528. int(0)
  529. int(%d)
  530. --- Testing a longer and heredoc string ---
  531. int(0)
  532. int(-%d)
  533. int(%d)
  534. --- Testing a heredoc null string ---
  535. int(-%d)
  536. int(0)
  537. int(-%d)
  538. --- Testing simple and complex syntax strings ---
  539. int(-%d)
  540. int(-%d)
  541. Notice: Undefined variable: strS in %s on line %d
  542. int(%d)
  543. int(-%d)
  544. int(-%d)
  545. --- Testing binary safe and binary chars ---
  546. int(%d)
  547. int(-%d)
  548. int(0)
  549. int(0)
  550. int(%d)
  551. int(%d)
  552. int(%d)
  553. --- Comparing long float values ---
  554. int(0)
  555. int(-%d)
  556. int(0)
  557. #### checking error conditions ####
  558. Warning: strcmp() expects exactly 2 parameters, 0 given in %s on line %d
  559. Warning: strcmp() expects exactly 2 parameters, 1 given in %s on line %d
  560. Warning: strcmp() expects exactly 2 parameters, 1 given in %s on line %d
  561. Warning: strcmp() expects exactly 2 parameters, 3 given in %s on line %d
  562. Done