Solved

Yet another parse error

Posted on 2007-12-03
2
197 Views
Last Modified: 2007-12-03
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
Comment
Question by:xamian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 20

Accepted Solution

by:
steelseth12 earned 125 total points
ID: 20397552
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
 
LVL 1

Author Comment

by:xamian
ID: 20397565
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question