Solved

Yet another parse error

Posted on 2007-12-03
2
192 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
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now