|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-04-17 20:49 UTC] ikickdogsforfun at hotmail dot com
Description: ------------ A # comment can be closed by a second # causing PHP to act rather oddly. Any errors that occur on the same line but after the closing # are reported as an error on the next line, however if there are no errors anything after the second # is ignored and not processed as if it was a comment. I think based on this, there needs to be some concistency about what happens when a second # is encountered. Are these intended to be embedded comments which can be be closed? Or should everything being ignored after the first # untill a new line character is encountered? Reproduce code: --------------- This produces 2 errors, one on line 2, one on line 3, though they are both about line 3: <? echo \"some ".# This is an imbedded comment#"text"; ?> This only echos out 'some': <? echo "some ".# This is an imbedded comment#"hi"; ?> Expected result: ---------------- I would expect to see 'some text' echoed out, as I was under the impression these kinds of comments were imbedded. Actual result: -------------- See the code section PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 26 07:00:01 2025 UTC |
no, # is a ONE line comment. the end of the line ended the comment. as for the error. you should get them as that code would break anyway. your lacking ; on the end of lines. {they are commented out} nothing on the line after the first # is read by the parser. the problem your having is that your ending your code before it's closed line three is ?> and the interpreter is seeing this and asking you about the messed up syntax <? echo \"some ". ?> these should be the two errors you are getting Warning: Unexpected character in input: '\' (ASCII=92) state=1 in file on line 2 Parse error: syntax error, unexpected ';' in file on line 3 done believe me? try this line which is a code complete and doesn't error <? echo "this ";#works# echo "works."; ?> if you were right about your logic then you should get this works else if I'm correct you will just get this