Jump to content

[SOLVED] $end error? custom error report function


MasterACE14

Recommended Posts

I have a custom function to simply 'kill' the executing script if there is a error and report a error message but I am receiving this error just by creating the function, not even calling it.

 

Parse error: syntax error, unexpected $end in /home/ace/public_html/conflictingforces/functions.php on line 211

 

the function:

<?php
function cf_error($message) { // display a error

  $error_message = <<<_MESSAGE
      <center class="box-bad">
      {$message}
      </center>
            _MESSAGE;

        die($error_message);
} // line 211

 

any ideas?

 

Regards ACE

you need to change

            _MESSAGE;

to

_MESSAGE;

so it is the first part of the line at the moment the string is not ending.

you should try using an editor like phpDesigner that will show errors like this

also why don't you just use " instead of <<< it works just the same.

 

Scott.

yep thats working now.

 

Thanks  :)

 

why don't you just use " instead of <<< it works just the same.

 

works the same, but makes everything much simpler to work with instead of having to escape quotes and special characters all the time when including variables and arrays.

 

Regards ACE

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.