I have a function (getSSOrders) that grabs data from an API. Since there is pagination, I am trying to get all of the order data from all pages. Right now my code adds an index to the array. Is there a way to just add the data to the $array_data without adding an index?
$page_counter = 1;
while ($page_counter <= $ss_pages) {
$ss_data = getSSOrders($page_counter);
$array_data[] = $ss_data['orders'];
$page_counter++;
}
Edit: Here is how I want the output:
Array
(
[0] => Array
(
[orderId] => 28058625
[orderNumber] => GS50340
[orderKey] => 92452700
)
[1] => Array
(
[orderId] => 28316205
[orderNumber] => GS50392
[orderKey] => 92511383
)
)
But with the while loop, I am getting:
Array
(
[0] => Array
(
[0] => Array
(
[orderId] => 28058625
[orderNumber] => GS50340
[orderKey] => 92452700
)
)
[1] => Array
(
[0] => Array
(
[orderId] => 28316205
[orderNumber] => GS50392
[orderKey] => 92511383
)
)
)
array_splice($array_data, 0);.$array_data[] = $ss_data['orders'];. I am not sure why you would want an array without an index, maybe a little clarification in your question may help.associative arrayin the title only, can you add more details about that requirement.$ss_data['orders']have?