从会话日期抓取密钥进行查询

First i will explain my setup:

I'm making a shipping calculator and i'm at the moment where i have the calculator working,the only problem is the zip,

The way i get the zip is out of a session data (see below)

$array = unserialize($_SESSION['__vm']['vmcart']); 

below is the foreach that will get the zip itself,

    foreach($array->BT as $key => $zip){
        if ($key == 'zip'){
            echo ' <strong>ZIP:</strong> '.$zip;

            if ($zip <= 7500){
                echo ' CPT';
            }else if ($zip <= 10000){
                echo ' JHB';
            }else{
                echo 'fail';
            }

        }

    }

The if statement with $zip <= 7500 and 10000 is just to check what is the closest location to the client,

the calculator then uses the zip to run a query to get the rates for the calculations to being.

My problem:

the calculator can't get the zip because it's in a foreach (the zip code above) i have tried to set the variable above the zips foreach but i get another key value from the array for some reason,if i use a different variable as the zip to test if the code works all is well so the problem must be in getting the zip from the foreach.

Please remember i'm new to php and programming in general.

Can anyone please help me with this i am stuck,if you need any information please ask, Thanks for reading!!

$zip= '';
foreach($array->BT as $key => $value){
    if ($key == 'zip'){
       $zip= $value;
    }
} 
# use $zip

or maybe shorter

$zip = $array->BT['zip'];