Asked by: starmoozie
im is very2 confused with this I have some problems with this condition, can anyone to help me?
I have array like this, and i get it from the database
array:2 [▼
0 => array:3 [▼
0 => "230"
1 => "305"
]
1 => array:1 [▼
0 => "tes"
]
]
//From Request
public function store(Request $request)
{
$k = $request->kode;
$l = $request->format;
$m = [
$k,
$l
];
dd($m);
How to get results like this?
tes = 230
tes = 305
Thankyou very much...
Answers
Answered by: sam12 at 2017-07-11 02:49PM
I'm not sure to understand. Do you want 230, 305 and tes in the same array? If yes, you can use collections: https://laravel.com/docs/5.4/collections#method-flatten and flatten() like this:
$arr= [0=>[230, 305], 1=>[0=>'tes']];
$coll=collect($arr)->flatten()->all();
dd($coll);
No comments:
Post a Comment