I have the following arrays:
[costs] => Array (
[0] => Array (
[value] => 600
[name] => Wood
)
[1] => Array (
[value] => 200
[name] => Stone
)
[2] => Array (
[value] => 800
[name] => Iron
)
[3] => Array (
[value] => 300
[name] => Gold
)
)
Array (
[0] => Array (
[balance] => 70636.86
)
[1] => Array (
[balance] => 70636.86
)
[2] => Array (
[balance] => 70636.38
)
[3] => Array (
[balance] => 141072.77
)
)
I want to check if the second array enough resources to spend from the first array and if one of the values from the first array is not = or less. Can someone help me out?
What I've tried so far:
for($i = 0; $i < 4; $i++)
{
$balance = $this->listResources[$i]['balance'];
if($balance >= $this->buildingCosts[$i]['value'])
$this->listBuildings[$i][$this->listKey]['status'][$balance] = '1';
else
$this->listBuildings[$i][$this->listKey]['status'] = '0';
}
What I'm trying to find out is to see if I have enough resources in array to spend ( values that I need are found in costs )