473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PHP "compiles" comments?

I was working on some php code yesterday and one of the lines in it
was:

print "<?xml version=\"1.0\" ?>\n";

when I tried to run it I would get an unexpected $end on the last line
of the script. After a while of debugging the code, commenting out
lines etc I figured out the above line was causing the issue by
changing it to:

print "<?xml version=\"1.0\" ?".">\n";

and it worked.

The reason I mention compiles comments in the subject, is even with
the original line commented php was still giving the error. I finally
figured out it didn't like the ?next to each other, it was seeing it
as an end to the script, even though it was originally in a print line
and then later in a commented line.

Is this normal, that you have to always seperate ?when using it in
php no matter where it is?

Bill H
Aug 28 '08 #1
2 1295
I'm not sure about the ?issue and php seeing it inside comments. Sounds
like a bug to me.

See if single quotes around the string works. It may be a better option to
use anyway:

print '<?xml version="1.0" ?>\n'; // with single string quotes, nothing
should be evaluated between the single quotes. Hopefully, the ?will not
be interpreted as a close script tag as before.

Also, as an aside, I understand echo instead of print in this context is
faster too.

so, echo '<?xml .... ';
"Bill H" <bi**@ts1000.uswrote in message
news:ab**********************************@c65g2000 hsa.googlegroups.com...
>I was working on some php code yesterday and one of the lines in it
was:

print "<?xml version=\"1.0\" ?>\n";

when I tried to run it I would get an unexpected $end on the last line
of the script. After a while of debugging the code, commenting out
lines etc I figured out the above line was causing the issue by
changing it to:

print "<?xml version=\"1.0\" ?".">\n";

and it worked.

The reason I mention compiles comments in the subject, is even with
the original line commented php was still giving the error. I finally
figured out it didn't like the ?next to each other, it was seeing it
as an end to the script, even though it was originally in a print line
and then later in a commented line.

Is this normal, that you have to always seperate ?when using it in
php no matter where it is?

Bill H

Aug 28 '08 #2
On 28 Aug, 22:01, "Joe Butler" <ffffh.no.s...@hotmail-spammers-
paradise.comwrote:
I'm not sure about the ?issue and php seeing it inside comments. *Sounds
like a bug to me.

See if single quotes around the string works. *It may be a better option to
use anyway:

print '<?xml version="1.0" ?>\n'; // with single string quotes, nothing
should be evaluated between the single quotes. *Hopefully, the ?will not
be interpreted as a close script tag as before.

Also, as an aside, I understand echo instead of print in this context is
faster too.
Please do not top post.
http://www.faqts.com/knowledge_base/...l/aid/1/fid/40
Aug 28 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: dave | last post by:
(Forgive all caps... they are there to differentiate btw question and code) THIS IS THE ERROR I KEEP GETTING. IT COMPILES BUT WHEN IT RUNS, THE FOLLOWING POPS UP: Exception in thread "main"...
205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
9
by: Morgan Cheng | last post by:
I'm using gcc 3.2.3. I'd like to add some detailed tutorial to my comments about the usage of the code. The tutoril includes some URI like "./ABC/CDE/*". The compiler thinks that I am using "/*"...
9
by: Ann Huxtable | last post by:
I have the following code segment - which compiles fine. I'm just worried I may get run time probs - because it looks like the functions are being overloaded by the return types?. Is this Ok: ? ...
35
by: David Cleaver | last post by:
Hello all, I was wondering if there were some sort of limitations on the "if" statement? I'm writing a program which needs to check a bunch of conditions all at the same time (basically). And...
10
by: albert.neu | last post by:
To what extent does Microsoft Visual C++ also called: VC++ also called: Microsoft (R) 32-bit C/C++ Optimizing Compiler support C99? VC++ compiles either in C mode (which is def. *not*...
5
by: Gianni Mariani | last post by:
I'm hoping someone can tell me why using member address of works and why using the dot operator does not in the code below. The code below uses the template function resolution mechanism to...
17
by: David C. Ullrich | last post by:
Having a hard time phrasing this in the form of a question... The other day I saw a thread where someone asked about overrideable properties and nobody offered the advice that properties are...
9
by: Rohit | last post by:
I am trying to initialize an array whose initializers depend on value of Enums. I take enum and then decide the initializer value, so that even if enum value changes because of addition to list...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.