Hi,
Normally we use the php switch statement to compare values and the isset to check if a variable is set and not null.
Is there anyway to use the switch statement to check if a variable is set.
Currently my code checks if the variable isset then runs a switch statement, can I use the switch statement to do the whole thing?
Example code:
Normally we use the php switch statement to compare values and the isset to check if a variable is set and not null.
Is there anyway to use the switch statement to check if a variable is set.
Currently my code checks if the variable isset then runs a switch statement, can I use the switch statement to do the whole thing?
Example code:
Code:
<?php
//display either 1.video, 2.image, 3.default image
if (isset($default['swfurl'])){
echo "flash video";
} else {
switch ($default['imageurl']){
case "":
echo "<li>no image</li>";
break;
default:
echo "<li>" . $default['imageurl'] . "</li>"; }
}
?>