Skip to content
Advertisement

php find item dimension in array

find items level(depth) in array;

hi im new in php and i cant find any method to find what dimension array items are in. for example:

JavaScript
JavaScript

the array above has key named email and the email key is in second level of the array. is there any function or method or way to find this level.

I found a method that tell you how deep array is: Is there a way to find out how “deep” a PHP array is?

Advertisement

Answer

Try using recursive function:

JavaScript

This will give you “Result: 2”

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