[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Yet another parse error

Can anyone tell me why I'm getting a parse error on this php script
<?
print verse(1);
print verse(2);
print verse(3);
print verse(4);
function verse($stanza)
{
      switch($stanza)
      {
      case 1:
      $place = "thumb";
      break;
      
      case 2:
      $place = "shoe";
      break;
      
      case 3:
      $place = "knee";
      break;
      
      case 4:
      $place = "door";
      break;
      
      default:
      $place = "I don't know where";
      }      
      $output = <<<END
      This old man, he played $stanza <br>
      he played knick-knack on my $place<br><br>
      END;
      return $output;
}//end verse
?>
0
xamian
Asked:
xamian
1 Solution
 
steelseth12Commented:
there should be no white space infront of END;

so it should be
<?
print verse(1);
print verse(2);
print verse(3);
print verse(4);
function verse($stanza)
{
      switch($stanza)
      {
      case 1:
      $place = "thumb";
      break;
      
      case 2:
      $place = "shoe";
      break;
      
      case 3:
      $place = "knee";
      break;
      
      case 4:
      $place = "door";
      break;
      
      default:
      $place = "I don't know where";
      }      
      $output = <<<END
      This old man, he played $stanza <br>
      he played knick-knack on my $place<br><br>
END;
      return $output;
}//end verse
?>

Open in new window

0
 
xamianAuthor Commented:
OK never mind I figured it out.  Apparently PHP is too stupid to ignore the space between the closing END.  Once I got rid of the tab in front of it the problem corrected itself.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now