0

How to make it as one array using PHP ?

["08:00 AM","08:15 AM","08:30 AM","08:45 AM"]
["09:00 AM","09:15 AM","09:30 AM","09:45 AM"]
["10:00 AM","10:15 AM","10:30 AM","10:45 AM"]
["11:00 AM","11:15 AM","11:30 AM","11:45 AM"]
["04:00 PM","04:15 PM","04:30 PM","04:45 PM"]
["05:00 PM","05:15 PM","05:30 PM","05:45 PM"]
["06:00 PM","06:15 PM","06:30 PM","06:45 PM"]

I want combine these array into one array like this

["08:00 AM","08:15 AM","08:30 AM","08:45 AM",
 "09:00 AM","09:15 AM","09:30 AM","09:45 AM",
 "10:00 AM","10:15 AM","10:30 AM","10:45 AM",
 "11:00 AM","11:15 AM","11:30 AM","11:45 AM",
 "04:00 PM","04:15 PM","04:30 PM","04:45 PM",
 "05:00 PM","05:15 PM","05:30 PM","05:45 PM",
"06:00 PM","06:15 PM","06:30 PM","06:45 PM"]
2
  • 7
    What did you try ? Commented Jan 24, 2019 at 10:53
  • i want combine multiple array into single Commented Jan 24, 2019 at 10:54

2 Answers 2

4

You the ... operator (PHP 5.6 and above variadic functions operator) with array-merge:

$arr = array(["aaa", "bbb"],["ccc","ddd"]);
$arr = array_merge(...$arr);
Sign up to request clarification or add additional context in comments.

Comments

1

Use the global built-in array_merge() function.

1 Comment

it is better if you provide some code.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.