Skip to content

Instantly share code, notes, and snippets.

@hungneox
Created November 17, 2013 20:06
Show Gist options
  • Save hungneox/7517658 to your computer and use it in GitHub Desktop.
Save hungneox/7517658 to your computer and use it in GitHub Desktop.
<?php
$data = array();
$data = array(
'channel' => 1,
'data' => array (
array(
'identity' => array('email' => 'email'),
'events' => array(
array('verb' => 'contact', 'data' => array('first-name' => 'my', 'last-name' => 'name', 'occupation' => 'yet another value')),
array('verb' => 'order', 'data' => array('item-name' => 'name of the item', 'price' => 100.0))
)
)
)
);
$temp = array(
array('verb' => 'order', 'data' => array('item-name' => 'name of the item 1', 'price' => 110.0)),
array('verb' => 'order', 'data' => array('item-name' => 'name of the item 2', 'price' => 120.0))
);
foreach ($temp as $item) {
# code...
$data['data'][0]['events'][] = $item;
}
print_r($data['data'][0]['events']);
@tpphu
Copy link

tpphu commented Nov 18, 2013

$data['data'][0]['events'] += $temp;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment