Creating a category page by alphabet

So, i used this script in the end, thanks to Pieter Goosen’s post Category Alphabet List Broken

$terms = get_terms('anime-on-going');

if ( !empty( $terms ) && !is_wp_error( $terms ) ){    
$term_list = [];    
foreach ( $terms as $term ){
    $first_letter = strtoupper($term->name[0]);
    $term_list[$first_letter][] = $term;
}
unset($term);

echo '<ul class="my_term-archive">';

    foreach ( $term_list as $key=>$value ) {
        echo '<h2 class="term-letter">' . $key . '</h2>';

        foreach ( $value as $term ) {
            echo '<li><a href="' . get_term_link( $term ) . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">'     . $term->name . '</a></li>';
        }
    }

echo '</ul>';
}