如何使用php拆分给定数组并从数组中获取值

Split below array and get values like

Category
Brand
Subcategory
Packaging
Packing

Array
 (
    [0] => Array
        (
            [0] => stdClass Object
                (
                    [col_ref_name] => Category
                )

        )

    [1] => Array
        (
            [0] => stdClass Object
                (
                    [col_ref_name] => Brand
                )

        )

    [2] => Array
        (
            [0] => stdClass Object
                (
                    [col_ref_name] => Subcategory
                )

        )

    [3] => Array
        (
            [0] => stdClass Object
                (
                    [col_ref_name] => Packaging
                )

        )

    [4] => Array
        (
            [0] => stdClass Object
                (
                    [col_ref_name] => Packing
                )

        )
)

use a code like below :

foreach($yourArray as $array) 
{

     echo $array[0]-> col_ref_name . "<br>";
}

Your array has objects in the sub array and col_ref_name is the property of that objects, so i used a foreach loop to go through all elements of the array (which are objects) and then access the data in the col_ref_name.

I hope this will help.