I do not see any way of asking it in a technical way, so I will be supported with images. I have an array which I get in a request in Laravel 5.6 that contains the following values:
The idea is to pass them to another array so that they remain like this:
That is to say
Edit1: Initially the array arrives to me in the following way:
Use a foreach to take all the values and store them in the array of the first image.
The code used to convert the array to the last image as it is in the first image.
foreach($fpagos as $fpago){
foreach($fpago as $dpago){
//dd($dpago);
$pagos_n[] = $dpago['name'];
$pagos_n[] = $dpago['value'];
}
}
Edit2: Try using the code you passed me, I think I used it wrong because I throw the same array without changes
foreach ($pagos_n as $key => $value){
$pagos_n[$key];
}