Below is my category array containing sub arrays and I want to find length of sub-array of each category array item.
[category] => Array(
[0] => Array(
[name] => Desktops
[children] => Array(
[0] => Array(
[name] => PC
[children3] => Array()
[column] => 1
[href] => http://192.168.0.101/user1/opc_laddylike3.0/upload/desktops/pc
)
[1] => Array(
[name] => Mac
[children3] => Array()
[column] => 1
[href] => http://192.168.0.101/user1/opc_laddylike3.0/upload/desktops/mac
)
)
[column] => 1
[href] => http://192.168.0.101/user1/opc_laddylike3.0/upload/desktops
)
[1] => Array(
[name] => Laptops & Notebooks
[children] => Array(
[0] => Array(
[name] => Macs
[children3] => Array()
[column] => 1
[href] => http://192.168.0.101/user1/opc_laddylike3.0/upload/laptop-notebook/macs
)
[1] => Array(
[name] => Windows
[children3] => Array()
[column] => 1
[href] => http://192.168.0.101/user1/opc_laddylike3.0/upload/laptop-notebook/windows
)
)
[column] => 1
[href] => http://192.168.0.101/user1/opc_laddylike3.0/upload/laptop-notebook
)
)
I want to find length of children of category array. Please check my code and help if I am wrong.
{% for category in categories %}
{% if category.children %}
{% for n in 0..(category.children|length) %}
Here I am getting category.children length as 1 for all array items.
Thanks in advance