In PHP I had to compare if an integer variable was less than a value of an array, but I had an error in the code and I found by chance an unexpected behavior.
I was comparing the integer with the array itself and it was returning true. Do you know why?
I've been searching about this in StackOverflow and php.net (PHP types comparisons) and I didn't found a specific answer.
Here you have a little code to test this.
<?php
$myArray = array();
$myInt = 1;
if($myInt < $myArray){
echo "Int less than array\n";
}
if($myInt == $myArray){
echo "Int equal to array\n";
}
if($myInt > $myArray){
echo "Int greater than array\n";
}
I've tried different values for $myInt and different contents for $myArray and it always prints this:
Int less than array
intresults in0.