php - How to remove index from array

994

I have following array :

Array
(
    [relation] => AND
    [0] => Array
        (
            [relation] => AND
            [0] => Array
                (
                    [key] => restaurant_country
                    [value] => India
                    [compare] => ==
                )

            [1] => Array
                (
                    [key] => restaurant_city
                    [value] => East Delhi - Noida
                    [compare] => ==
                )

        )

    [1] => Array
        (
            [relation] => OR
            [0] => Array
                (
                    [key] => restaurant_price_min
                    [value] => 100
                    [compare] => <=
                )

            [1] => Array
                (
                    [key] => restaurant_price_min
                    [value] => 500
                    [compare] => <=
                )

        )

)

I want to remove indexing from the above array. e.g I want the following array instead of above.

Array
(
    [relation] => AND
    Array
        (
            [relation] => AND
            [0] => Array
                (
                    [key] => restaurant_country
                    [value] => India
                    [compare] => ==
                )

            [1] => Array
                (
                    [key] => restaurant_city
                    [value] => East Delhi - Noida
                    [compare] => ==
                )

        )

    Array
        (
            [relation] => OR
            [0] => Array
                (
                    [key] => restaurant_price_min
                    [value] => 100
                    [compare] => <=
                )

            [1] => Array
                (
                    [key] => restaurant_price_min
                    [value] => 500
                    [compare] => <=
                )

        )

)

I want array in this format because wordpress query run in this way.

I am not getting how to do this.

Please help me.

140

Answer

Solution:

The array you want is simply not possible, because each array has its key, you can't remove it.

520

Answer

Solution:

It seem's to be a var_export display. Maybe you are trying to show it with print_r ?

even answer of 3DR is correct, it's impossible..

People are also looking for solutions to the problem: can't understand this function from php manual example (return bytes)

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.