I have the following response and I was wanting to know how can I turn it into an multidimensional array foreach item [0][1] etc
Controller $rece Response:
array(16) { ["digital_delivery"]=> int(1) ["original_referrer"]=> string(11) "No Referrer" ["shop_rule_us_state_code"]=> string(1) "0" ["subtotal_ex_vat"]=> string(4) "9.99" ["subtotal_inc_vat"]=> string(4) "9.99" ["tax_amount"]=> string(4) "0.00" ["delivery_price"]=> string(4) "0.00" ["discount_deduction"]=> string(4) "0.00" ["currency_code"]=> string(3) "GBP" ["total"]=> string(4) "9.99" ["paid"]=> int(1) ["created"]=> string(19) "2013-10-31 21:03:44" ["website_id"]=> string(2) "64" ["first_name"]=> string(3) "Joe" ["last_name"]=> string(5) "Blogs" ["email"]=> string(17) "
[email protected]" } array(16) { ["digital_delivery"]=> int(1) ["original_referrer"]=> string(11) "No Referrer" ["shop_rule_us_state_code"]=> string(1) "0" ["subtotal_ex_vat"]=> string(4) "9.99" ["subtotal_inc_vat"]=> string(4) "9.99" ["tax_amount"]=> string(4) "0.00" ["delivery_price"]=> string(4) "0.00" ["discount_deduction"]=> string(4) "0.00" ["currency_code"]=> string(3) "GBP" ["total"]=> string(4) "9.99" ["paid"]=> int(1) ["created"]=> string(19) "2013-10-31 21:03:44" ["website_id"]=> string(2) "64" ["first_name"]=> string(3) "Joe" ["last_name"]=> string(5) "Blogs" ["email"]=> string(13) "
[email protected]" } array(16) { ["digital_delivery"]=> int(1) ["original_referrer"]=> string(11) "No Referrer" ["shop_rule_us_state_code"]=> string(1) "0" ["subtotal_ex_vat"]=> string(4) "9.99" ["subtotal_inc_vat"]=> string(4) "9.99" ["tax_amount"]=> string(4) "0.00" ["delivery_price"]=> string(4) "0.00" ["discount_deduction"]=> string(4) "0.00" ["currency_code"]=> string(3) "GBP" ["total"]=> string(4) "9.99" ["paid"]=> int(1) ["created"]=> string(19) "2013-10-31 21:03:44" ["website_id"]=> string(2) "64" ["first_name"]=> string(3) "Joe" ["last_name"]=> string(5) "Blogs" ["email"]=> string(15) "
[email protected]" }
Controller:
foreach ($this->receivers as $rece)
{
$order_data['first_name'] = $rece[0];
$order_data['last_name'] = $rece[1];
$order_data['email'] = $rece[2];
$order_id = $this->orders_model->add_order_multi($order_data, $order_products_data);
$this-receivers function:
public function parse_receivers($receivers)
{
$this->receivers = explode( "\n", trim($receivers) );
$this->receivers = array_filter($this->receivers, '
trim');
$validReceivers = false;
foreach($this->receivers as $key=>$receiver)
{
$validReceivers = true;
$this->receivers[$key] = array_map( '
trim', explode(',', $receiver) );
if (count($this->receivers[$key]) != 3)
{
$line = $key + 1;
$this->form_validation->set_message('parse_receivers', "There is an error in the %s at line $line ($receiver)");
return false;
}
}
return $validReceivers;
}