What are some best practices for structuring categories and subcategories in PHP for a forum?

When structuring categories and subcategories in PHP for a forum, it is important to create a hierarchical structure that allows for easy navigation and organization of topics. One common approach is to use a multidimensional array to represent the categories and subcategories. Each category can contain an array of subcategories, and each subcategory can contain an array of topics.

$forum = array(
    'Category 1' => array(
        'Subcategory 1.1' => array(
            'Topic 1.1.1',
            'Topic 1.1.2'
        ),
        'Subcategory 1.2' => array(
            'Topic 1.2.1',
            'Topic 1.2.2'
        )
    ),
    'Category 2' => array(
        'Subcategory 2.1' => array(
            'Topic 2.1.1',
            'Topic 2.1.2'
        ),
        'Subcategory 2.2' => array(
            'Topic 2.2.1',
            'Topic 2.2.2'
        )
    )
);