php - How to create multiple array in Laravel 5?
463
I want to make multiple array by php (Laravel 5). There are two arrays as follows.
$tags=['en' =>[]];
$TAGS = ['test1','test2','test3',...]
I want to make this array as a return value in certain code like this:
return [
'tags' => [
'en' => [
'test1' => 'test1',
'test2' => 'test2',
'test3' => 'test3',
...
]
]
]
I tried the following, but it did not work.
return [
'tags' => [
'en' => [
foreach($TAGS as $TT)
array_push($tags['en'], $TT);
]
]
]
Is there any other way?
Answer
Solution:
Try like this :
Answer
Solution:
Try this -