Skip to content
Advertisement

How can I extract values from an array (array_values isn’t working)?

I have the following PHP array

JavaScript

I would like the output to be as follows:

JavaScript

I tried using array_values but I’m not getting any output.

I also tried to extract the values using a foreach loop:

JavaScript

However, I’m not managing.

Advertisement

Answer

I managed to solve the problem by initializing an array and adding values of subsequent nested arrays using array_push

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement