1--TEST-- 2Test < operator : max int 32bit range 3--FILE-- 4<?php 5 6define("MAX_64Bit", 9223372036854775807); 7define("MAX_32Bit", 2147483647); 8define("MIN_64Bit", -9223372036854775807 - 1); 9define("MIN_32Bit", -2147483647 - 1); 10 11$validLessThan = array ( 122147483646, array(MAX_32Bit, "2147483647", "2147483647.001", 2.147483647e9, 2147483647.9), 13MIN_32Bit, array(MIN_32Bit + 1, "-2147483647", "-2147483646.001", -2.1474836461e9, -2147483646.9), 14); 15 16$invalidLessThan = array ( 17MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1), 18MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9) 19); 20 21$failed = false; 22// test for equality 23for ($i = 0; $i < count($validLessThan); $i +=2) { 24 $typeToTestVal = $validLessThan[$i]; 25 $compares = $validLessThan[$i + 1]; 26 foreach($compares as $compareVal) { 27 if ($typeToTestVal < $compareVal) { 28 // do nothing 29 } 30 else { 31 echo "FAILED: '$typeToTestVal' >= '$compareVal'\n"; 32 $failed = true; 33 } 34 } 35} 36// test for invalid values 37for ($i = 0; $i < count($invalidLessThan); $i +=2) { 38 $typeToTestVal = $invalidLessThan[$i]; 39 $compares = $invalidLessThan[$i + 1]; 40 foreach($compares as $compareVal) { 41 if ($typeToTestVal < $compareVal) { 42 echo "FAILED: '$typeToTestVal' < '$compareVal'\n"; 43 $failed = true; 44 } 45 } 46} 47 48if ($failed == false) { 49 echo "Test Passed\n"; 50} 51 52?> 53--EXPECT-- 54Test Passed 55