I am trying to take a PHP variable from one static function to another as the value of the PHP variable is received using a $_GET. I am getting the customers ID and I want to use the customer ID in another function.
First Function with the $_GET:
static function createProject($pParamArray)
{
$result = $pParamArray;
$result['result'] = '';
$result['useraccount'] = array();
$result['updategroupcode'] = 0;
$result['updateaccountdetails'] = 0;
$result['updateaccountbalance'] = 0;
$result['updategiftcardbalance'] = 0;
$result['ssotoken'] = '';
$result['ssoprivatedata'] = array();
$result['assetservicedata'] = array();
$result['ssoexpiredate'] = '';
$result['projectname']="Personalised Parties - ".date('D M Y');
$result['guestworkflowmode'] = 1;
$result['cansignin'] = 0;
$result['editprojectnameonfirstsave'] = 0;
//grabs customer id from Magento 2
$result['userdata'] = $_GET['customerid'];
return $result;
}
Second Function where I'm trying to call the PHP variable from the other function:
static function initialise($pParamArray)
{
//create customer
$customerData = [
'customer_id' => $result['userdata'] //the PHP variable I'm trying to call from the other function
];
}
How would I be able to do this. I'm relatively new to PHP.
$customerData = self::createProject($pParamArray);