Solved

Yet another parse error

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

920 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

14 Experts available now in Live!

Get 1:1 Help Now