I have a php related question about the if statement. I have this piece of code:
<?php if(count($targetValue) > 0 ): ?>
<?php foreach($targetValue as $key=>$val): ?>
<div class="<?php echo $key ?>">
<span>
<?php echo $val ?>
</span>
</div>
<br>
<?php endforeach; ?>
<?php endif;?>
The $val can return up to 10 different values that are pre-defined. I need to know how to check if a value equals a word, then show this.
Example: If $val == "Pinda" then show X. After that, if $val == "Mosterd" then show Y.
For every option that $val returns I want to show a different image.
Regards
Aucun commentaire:
Enregistrer un commentaire