I have a class like this
Code: Select all
class item
{
private $itemName;
private $activeFrom;
private $activeTo;
function __construct($itemName, $activeFrom, $activeTo)
{
$this->itemName = $itemName;
$this->activeFrom = $activeFrom;
$this->activeTo = $activeTo;
}
}Now I have an array of class item, this is the array
Code: Select all
$itemArray = array();
$item = new item("item1", "2006-01-01", "2006-01-10");
$itemArray[] = $item;
$item = new item("item2", "2006-01-10", "2006-01-15");
$itemArray[] = $item;
$item = new item("item3", "2006-01-15", "2006-01-20");
$itemArray[] = $item;
$item = new item ("item4", "2006-01-20", "2006-01-28");
$itemArray[] = $item;Code: Select all
$startDate = "2006-01-05";
$endDate = "2006-01-18";So with that start and end date, item1, item2, and item3 should all be in the array, but item4 shouldnt since it doesnt fall in the range.
Now I know this should be relatively simple, but for some reason my brain isn't working today.
Thanks in advance