I have an array which I am using some method to make an api call. I have 2 methods out of which I need to select 1 based on the session value.
My array looks like this.
$order_params = array(
'username' => 'test1',
'password' => 'test2',
'method' => 'Gateway1');
So if session value is not null than method needs to be Gateway2 and need to pass one more parameter. What I am doing is using this way to update the array.
$order_params = array(
'username' => 'test1',
'password' => 'test2',
'method' => 'Gateway1');
if($_SESSION['userid'] != ''){
$order_params['method'] = 'Gateway2';
$order_params['proid'] = '222'
}
I need to confirm if I am doing the right way, OR if there is a more better way to do this.
Aucun commentaire:
Enregistrer un commentaire