I am trying to use a simple php switch case() statement below, but for some reason it is unable to function:
<?php
switch($ad)
{
case "1";
echo "This is first php switch case statement";
break;
case "2";
echo "This is second php switch case statement";
break;
default;
echo "This is default php switch case statement";
break;
?>Hope someone can help and explain the reasons why
cheers,
Tim
2 years 2 days ago
Tim, your php switch case should end with colon (:) not semi-colon (;).
<?php
switch($ad)
{
case "1"<b>:</b>
echo "This is first php switch case statement";
break;
case "2"<b>:</b>
echo "This is second php switch case statement";
break;
default<b>:</b>
echo "This is default php switch case statement";
break;
?>
Make sense?
That indeed worked. I am still learning.
Tim