I am trying to use a foreach statement to display a list ul>li. In case the list has no elements how can i handle that criteria.
<ul>
<?php foreach($person['CastsMovie'] as $cast): ?>
<li><?php echo $this->Html->link($cast['Movie']['name'], array('controller' => 'movies', 'action' => 'view', $cast['movie_id'], 'admin' => true), array('escape' => false)); ?> (<?php echo date("Y", strtotime($cast['Movie']['MovieDetail']['release_date'])); ?>)</li>
<?php endforeach; ?>
</ul>
Check whether it is empty or not: