I currently have 2 arrays where i would like to compare dates in. here are how my arrays are structured:
$bholidays = array('05-05-2014','26-05-2014');
$userdaysoff = array('23-05-2014','24-05-2014','25-05-2014', '26-05-2014');
The aim is to detect whether or not a value from $userdaysoff exists in the $bholidays array.
The above works great and detects that 26-05-2014 exists in both arrays, but if the $userdaysoff array looks like this:
$userdaysoff = array('26-05-2014','27-05-2014','28-05-2014', '29-05-2014');
Then the duplicate date 26-05-2014 is not detected.
Is there any reason why this would be occuring?
here is how i run my code:
$results = array_intersect($bholidays, $userdaysoff);
if($results){
foreach($results as $result){
echo 'yes';
}
} else {
echo 'no';
}