I have set a variable in one function and I am trying to use it in another. People seem to be advising against using globals for functions.
This code is in my first variable
if($this->CheckAndSetupContractHitman($player_data_tab,$player_defence_data_tab)) $winner_exp = $winner_exp + floor($winner_exp*0.4);
if($this->CheckAndSetupContractHitman($player_data_tab,$player_defence_data_tab)) $bonus_exp = floor($winner_exp*0.2857);
It is the variable $bonus_exp that I am trying to pass on to another function. Should I add return $bonus_exp; at the end of the first variable and then add $bonus_exp as an argument to the second variable like so?
function CheckAndSetupContractHitman($player_data_tab,$player_defence_data_tab,$bonus_exp)