I'm trying to loop through an Array, and add "active" class to first iteration only.
this is what I have tried so far but couldn't get it to work.
<?php foreach ($env_list as $key): ?> <?php $isFirst = true; ?> <li class="<?php $isFirst ? 'active' : ?>"> <a data-toggle="tab" href="#<?php echo $key['env_name'] ?>" id="<?php echo $key['id'] ?>"> <?php echo $key['env_name'] ?></a></li> <?php $isFirst = false; ?> <?php endforeach ?> Your assistance is highly appreciated