I am using the following code to produce an array:
// Create new customer object
$customers = new customers;
// Array of user ids
$customers->ids = array(34,23,78);
// Process customers
$customers->processCustomers();
The above code will output an array full of needed user information based on the users passed to it.
Now I need to take further action to this new customer array in the following code:
// Create new parsing object
$parseCustomers = new parse;
// Array of customer data
$parseCustomers->customers = ???????????
// Finalize new transaction
$parseCustomers->finalizeTransaction();
I need to pass the array from the first class output into the second and I’m wondering what best practice is.
This customer array can be very large at times, so ideally I wouldn’t have 2 variables containing the same array at any time.
If you mean the processed array from the
$customersobject, you need some public method to get that data.Let’s assume you have a public method
getData(). Your code would then look like this…