I have a function that grabs data from a url and parses it into an array. So I have one array inside another array so:
ARRAY {
- First Post
-- Author
--- Fred
-- Date
--- 13/3/1998
-- URL
--- example.com
- Second Post
-- Author
--- Fred
-- Date
--- 13/3/1998
-- URL
--- example.com }
and I was wondering how I add an entry to each of the arrays in a foreach loop so I could get
ARRAY {
-- Author
--- Fred
-- Date
--- 13/3/1998
-- URL
--- example.com
-- Shortcode
--- abc123
- Second Post
-- Author
--- Fred
-- Date
--- 13/3/1998
-- URL
--- example.com
-- Shortcode
--- abc123 }
<?php
$first_array = array_slice($your_array, 0, 6); // 6 or 7 I forget which one it will take
$second_array = array_slice($your_array, 7);
$first_array = array_push($first_array, $new_value);
$second_array = array_push($second_array, $new_value);
$new_array = array_merge($first_array, $second_array);
print_r($new_array);
?>