如何在函数与数组值之间使用[关闭]

I need to compare one of the array values with one date.

For example,

$first_date = array ( [0] => 24-10-13 [1] => 18-10-13 );
$my_date = 01-10-13;

I need to compare, whether my date is in between the $first_date array.

<?php
$first_date = array ( '24-10-13','18-10-13');
$my_date[] = '18-10-13';
$result = array_intersect($first_date, $my_date);
print_r($result);
?>
$first_date = array ('01-10-13', '18-10-13');
$my_date = '11-10-13';
if(strtotime($my_date) > strtotime($first_date[0]) && strtotime($my_date) < strtotime($first_date[1])) {
    // Do some
}

At first your date should be in format of 24-10-2013,Now you can change every date in array and another date to be checked to second using strtotime()

$strtdate=strtotime($first_date[1]);
$enddate=strtotime($first_date[0]);
$checkdate=strtotime($my_date);

now as you know you can use if statement and less than and greater than to check if your date is in between of these two days.

if($strtdate<=$checkdate && $checkdate<=$enddate)
{
echo "date is in between";
}else{
echo "not between";
}