[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Yet another parse error

Posted on 2007-12-03
2
Medium Priority
?
202 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 500 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

649 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