<span id="childTopic<?php echo $parent_topic_id;?>">
    <?php
    $i = 0;
    foreach ($topic_info['child_topic'][$parent_topic_id] as $child_topic_value) {
        ++$i;
        ?>
        <div class="checkbox checkbox-success">
            <input type="checkbox" name="course" class="course_checkbox" id="VideoCourseChildTopic<?php echo $child_topic_value->topic_id ?>">
            <label for="course"><?php echo $child_topic_value->topic_name ?></label>
        </div>
    <?php } ?>
</span>   
    <?php
    if ($i < $topic_info['total_child_topic'][$parent_topic_id]) {
    ?>
    <a
       id="moreChildTopic<?php echo $child_topic_value->topic_id ?>" 
       href="javascript:void(0)" onclick="moreChildTopic('<?php echo $parent_topic_id ?>')">more</a>
    <?php
    }
    ?>