I just want to add a class if li is parent class should be level-0 and if li is the child then level-1 etc. I am using the following loop.
<?php
$categories = get_categories();
foreach($categories as $category) {
echo '<li class="here-i-want-to-add"><a href="' . get_category_link($category->term_id) . '">' . $category->name . '</a></li>';
}
?>