I have defined a const with an array.
CONST DEFAULT_PRICES = array(30, 20, 10);
Now I have used this constant inside in function like below:
foreach ($workingDays as $selectedDate) {
//get the index
$index = array_search($selectedDate, $workingDays);
$price = $basePrice + ($basePrice * self::DEFAULT_PRICES[$index ] / 100);
$price = sprintf("%.2f", $price);
$dateArr[$selectedDate] = $basePrice;
}
But I am getting error saying Message: Undefined offset: 3
can anybody tell me why?