[Solved] php how to get all values array but array_values not working?


Seems like you want to grab all the arrays inside the item keys? Using array_column and specifying the item as the key will return the arrays inside each item key in a new array. If that is what you’re after? The question was kind of hard to understand IMHO.

array_column($array, 'item');

This will return an array on the following structure.

Array
(
    [0] => Array
        (
            [name] => ttt
            [price] => 100
            [quantity] => 1
        )

    [1] => Array
        (
            [name] => sss
            [price] => 100
            [quantity] => 1
        )

    [2] => Array
        (
            [name] => vvv
            [price] => 100
            [quantity] => 1
        )
)

Here’s a demo showing it working.

solved php how to get all values array but array_values not working?