In my php applicaiton I have the following code:
try {
$ordersIngredients[$userIngredient->getId()][$day] += $quantity;
} catch (\Exception $e) {
~r(array(
$ordersIngredients[$userIngredient->getId()],
$day,
array_key_exists($day, $ordersIngredients[$userIngredient->getId()]),
$e->getMessage()
));
}
The r()
function prints the following:
array(4)
0 => array(4)
0 => 0.9
1 => null
2 => null
3 => 1
)
1 => 3
2 => true
3 => Notice: Undefined offset: 3
)
How can I have an error on un undefined offset when the offset actually exists given the dump of the array and array_key_exists ?