I am trying to compare the values of 2 arrays with the same key and see if the value of the array with the same key is greater than the other. Here's the arrays:
Array
(
[3203] => 2
[7276] => 1
)
Array
(
[3203] => 1
[7276] => 1
)
The part of the code that produced the array above:
foreach ($this->request->post['quantity'] as $key => $value)
{
$cart_value[$key] = $value;
}
foreach ($this->session->data['cart'] as $id => $val) {
$stock[$id] = $this->cart->availableStock($id);
}
How can I compare the value of each key?
I have this if else statement:
if ($cart_value > $stock) {
// do something<br>
} elseif ($cart_value = $stock) {
// do another thing
} else {
// do this thing
}
Thank you for your help.