I have the following json:
$data = '{"code":"08261",
          "currency":"EUR", 
          "packs":[ {"amount":0.05,"measure":"g","price":73.0}, 
                    {"amount":0.1,"measure":"g","price":108.0}, 
                    {"amount":0.25,"measure":"g","price":154.0}, 
                    {"amount":0.5,"measure":"g","price":296.0}, 
                    {"amount":1.0,"measure":"g","price":394.0}, 
                    {"amount":2.5,"measure":"g","price":771.0}, 
                    {"amount":5.0,"measure":"g","price":1142.0}, 
                    {"amount":10.0,"measure":"g","price":1693.0}]}'; 
I can get the value of code and currency as follows:
// Option 1: through the use of an array.
$jsonArray = json_decode($data,true);
$code =  $jsonArray['code'];
// Option 2: through the use of an object.
$jsonObj = json_decode($data);
$code = $jsonObj->code;
How can I get the price for the following packs where the:
- amount is '1.0' and measure is 'g'
- amount is '5.0' and measure is 'g'
- amount is '10.0' and measure is 'g'
 
     
    