1--TEST--
2Test <= operator : different types
3--FILE--
4<?php
5$valid_true = array(1, "1", "true", 1.0, array(1));
6$valid_false = array(0, "", 0.0, array(), NULL);
7
8$int1 = 678;
9$int2 = -67836;
10$valid_int1 = array("679", "679abc", " 679", 679.0, 6.79E2, "678", "678abc", " 678", 678.0, 6.78E2, 6.789E2, "+678", +678);
11$valid_int2 = array("-67835", "-67835abc", " -67835", -67835.000, -6.7835E4, "-67836", "-67836abc". " -67836", -67835.0001, -6.78351E4, "-67836", -67835.0001, -6.78351E4);
12$invalid_int1 = array(677, "677");
13$invalid_int2 = array(-67874, "-67837");
14
15$float1 = 57385.45834;
16$float2 = -67345.76568;
17$valid_float1 = array("57385.45835",  "57385.45835aaa", "  57385.45835", 5.738545835e4, "57385.45834",  "57385.45834aaa", "  57385.45834", 5.738545834e4);
18$valid_float2 = array("-67345.76567", "-67345.76567aaa", "  -67345.76567", -6.734576567E4, "-67345.76568", "-67345.76568aaa", "  -67345.76568", -6.734576568E4);
19$invalid_float1 = array(57385.45833, 5.738545833e4);
20$invalid_float2 = array(-67345.76569, -6.734576569E4);
21
22$toCompare = array(
23  true, $valid_true, $valid_false,
24  false, array_merge($valid_false, $valid_true), NULL,
25  $int1, $valid_int1, $invalid_int1,
26  $int2, $valid_int2, $invalid_int2,
27  $float1, $valid_float1, $invalid_float1,
28  $float2, $valid_float2, $invalid_float2
29);
30
31$failed = false;
32for ($i = 0; $i < count($toCompare); $i +=3) {
33   $typeToTest = $toCompare[$i];
34   $valid_compares = $toCompare[$i + 1];
35   $invalid_compares = $toCompare[$i + 2];
36
37   foreach($valid_compares as $compareVal) {
38      if ($typeToTest <= $compareVal) {
39         // do nothing
40      }
41      else {
42         echo "FAILED: '$typeToTest' > '$compareVal'\n";
43         $failed = true;
44      }
45   }
46
47   if ($invalid_compares != NULL) {
48	   foreach($invalid_compares as $compareVal) {
49	      if ($typeToTest <= $compareVal) {
50	         echo "FAILED: '$typeToTest' <= '$compareVal'\n";
51	         $failed = true;
52	      }
53	   }
54   }
55
56}
57if ($failed == false) {
58   echo "Test Passed\n";
59}
60?>
61===DONE===
62--EXPECT--
63Test Passed
64===DONE===