Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $data[] = [
- 'sponsor_id' => 2,
- 'enroller_id' => 4,
- ];
- //using [] after $data will concatenate otherwise override
- $data[] = [
- 'sponsor_id4' => 2,
- 'enroller_id5' => 4,
- ];
- //Following above there are two arrays in one array
- print_r($data);
- echo "<br />";echo "<br />";echo "<br />";
- //To make it one array - so that new values add as an index
- $data3 = [
- 'sponsor_id' => 2,
- 'enroller_id' => 4,
- ];
- $my_array1 = array("sponsor_id2" => 4 );
- $my_array2 = array("enroller_id3" => 5);
- $res = array_merge($data3, $my_array2, $my_array1);
- print_r($res);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement