What are the advantages and disadvantages of using arrays to represent hierarchical data in PHP?

When representing hierarchical data in PHP using arrays, one advantage is that it allows for easy traversal and manipulation of the data structure. However, a disadvantage is that it can become complex and difficult to manage, especially with deeply nested arrays.

// Example of representing hierarchical data using arrays
$data = [
    'name' => 'John',
    'children' => [
        [
            'name' => 'Alice',
            'children' => []
        ],
        [
            'name' => 'Bob',
            'children' => [
                [
                    'name' => 'Charlie',
                    'children' => []
                ]
            ]
        ]
    ]
];