Jump to content

PHP Error Skipping Comment Lines


benphp

Recommended Posts

This is new. For some reason, the PHP errors are not counting my //commented lines.

 

Example:

<?php
//my comment
:
?>

Parse error: syntax error, unexpected ':' in D:\www\myscript.php on line 2

 

The error is on line 3. If I add more comments, the error is the same:

<?php
//my comment
//my comment
//my comment
//my comment
//my comment
:
?>

Parse error: syntax error, unexpected ':' in D:\www\myscript.php on line 2

 

Where is this setting?

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/293016-php-error-skipping-comment-lines/
Share on other sites

And if there's a space in front of the comment? Or a lone semicolon?

 

[edit] And while I'm here, how are these files being executed? And what do you get if you do

<?php
//my comment
//my comment
//my comment
//my comment
//my comment
echo "<pre>\n"; print_r(file(__FILE__)); echo "\n</pre>\n";
?>

And if there's a space in front of the comment? Or a lone semicolon?

 

[edit] And while I'm here, how are these files being executed? And what do you get if you do

<?php
//my comment
//my comment
//my comment
//my comment
//my comment
echo "<pre>\n"; print_r(file(__FILE__)); echo "\n</pre>\n";
?>

Results:

Array
(
    [0] =>  //my comment

    [2] => //my comment

    [3] => //my comment

    [4] => //my comment

    [5] => //my comment

    [6] => echo "\n"; print_r(file(__FILE__)); echo "\n\n";

    [7] => ?>
)

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.