Hello everyone i get some problem when try learn php with laravel, there is the problem …
i have an array structure like this :
array:3 [▼ 0 => 16 1 => 19 2 => 15 ]
how can u change the array structure to look like this :
array:3 [▼
0 => array:1 [▼
0 => 16
]
1 => array:1 [▼
0 => 19
]
2 => array:1 [▼
0 => 15
]
]
im newb ,can somebody help me, im using laravel 5.8 ,very grateful if someone helps. sorry for my broken english.
Advertisement
Answer
i found it !
use array_chunck()
$convert = array_chunk($data, 1); dd($convert);
output:
array:3 [▼
0 => array:1 [▼
0 => 16
]
1 => array:1 [▼
0 => 19
]
2 => array:1 [▼
0 => 15
]
]