2
<?php
  require_once('Auth/Auth-1.6.4/Auth.php');

  class MyAuth extends Auth
  {
    function custom_login( $username = null, $status = null )
    {
      if( $status == AUTH_WRONG_LOGIN )
        $status_msg = 'nameORpasswordWRONG';
      else
        $status_msg = '';

      echo <<<LOGIN_FORM
      LOGIN_FORM;
    }
  }
?>

I get the following error:

syntax error, unexpected $end

I got this error when I added the following lines:

echo <<<LOGIN_FORM  
LOGIN_FORM;

I checked }, but they seem to correct. Can somebody help me?

1
  • Your going to have to expand a bit more on this. Why is this happening what did you add echo to, what are you trying to achieve? Commented Jan 10, 2012 at 16:06

4 Answers 4

5

There must be no whitespace between the new line and the closing LOGIN_FORM;

See the big warning in the documentation

Sign up to request clarification or add additional context in comments.

Comments

4

Heredoc style string enders cannot be indented.

Comments

3

When using HEREDOCs, the end tag must be on the line by itself. No white space before it.

<?php
  require_once('Auth/Auth-1.6.4/Auth.php');

  class MyAuth extends Auth
  {
    function custom_login( $username = null, $status = null )
    {
      if( $status == AUTH_WRONG_LOGIN )
        $status_msg = 'nameORpasswordWRONG';
      else
        $status_msg = '';

      echo <<<LOGIN_FORM
LOGIN_FORM;
    }
  }
?>

Make sure there's no whitespace before LOGIN_FORM;.

Comments

2

LOGIN_FORM has to be flush with the very left. See the PHP documentation on HEREDOCs

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.