dimanche 18 mars 2018

calling variable inside previous block of IF statement in another block

i have this scenero, i have if statement like below, however i want to call the variable set in one block of IF statement and use it in another block of IF statement. Kindly look at the scenero in the code below

function($month){

if($month = jan){
    $amount_jan = 1000;
    }
if($month== feb){
//please note, amount_jan is from previous bloc
    $amount_feb = $amount_jan + 1000;
}
if($month== mar){
    $amount_marb = $amount_feb + 1000;
}

}

Aucun commentaire:

Enregistrer un commentaire