Skip to content
Advertisement

php multidimensional array get values

This is my array in php $hotels

JavaScript

How can I get board_id and price I have tried few foreach loops but can’t get the result

JavaScript

This code didn’t work.

Advertisement

Answer

This is the way to iterate on this array:

JavaScript

You want to iterate on the hotels and the rooms (the ones with numeric indexes), because those seem to be the “collections” in this case. The other arrays only hold and group properties.

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