Searching multidimensional array for same value and return the array main key for the value

hello i have this array:-

Array
(
    [status] => 1
    [msg] => Array
        (
            [total_records] => 5
            [total_pages] => 1
            [page_number] => 1
            [per_page] => 100
            [return_count] => 5
            [page_result] => Array
                (
                    [0] => Array
                        (
                            [items] => 223687201
                            [stock] => hat
                            [stock] => 0
                        )

                    [1] => Array
                        (
                            [items] => 218508001
                            [category] => bags
                            [stock] => 3
                        )

                    [2] => Array
                        (
                            [items] => 180097801
                            [category] => shirt
                            [stock] => 5
                        )

                    [3] => Array
                        (
                            [items] => 178000403
                            [category] => shirt
                            [stock] => 2
                        )

this key---->[4] => Array
                        (
                            [items] => 200052001
                            [category] => shoes
                            [stock] => 1
                        )

                )

        )

    [errcode] => 0
)

i want an array function/code that can only return an array key(see arrow) that have the same value(category) in the array.

In JavaScript or PHP?

in PHP code. I have low experience in JavaScript.

Check the link I posted…

i have check it. Thank you :slightly_smiling_face:

Sponsor our Newsletter | Privacy Policy | Terms of Service