473,786 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1312
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.us wrote in message
news:ab******** *************** ***********@c65 g2000hsa.google groups.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.comwro te:
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
45750
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" java.lang.NoClassDefFoundError: PlayClip THIS IS MY CODE: import java.applet.*; import java.io.*; import java.net.*;
205
10711
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
2168
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 "/*" in "/* */" and doesn't pass. Is there any solution to add "/*" in "/* */" comments? Thanks
9
2732
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: ? template <class T1, class T2> int getValue( T1 col, T2 row ) ; template <class T1, class T2> double getValue( T1 col, T2 row ) ;
35
2741
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 I'm pretty sure the rest of the program is working just fine. The only thing I could think might be wrong is that the if statement can only hold so many values in itself? Let me show what I'm doing: if (table001]>>5]&b&0x1f] != 0 &&
10
13400
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* C99!):
5
2596
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 determine wether a class contains a member. My understanding is that if a template function has an error during resolution of the function types, it is quietly eliminated from the resolution process. This can be used to detect things that would...
17
2787
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 Bad. So maybe we've got over that. I suppose properties could have Bad consequences if a user doesn't know they exist and think that a certain property of an object is just an ordinary attribute. But that applies to
9
11197
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 even then I should be able to get correct value for the array element. I need value and state to be present in a single byte thats why I use macros. Here is what my code look like: typedef enum
0
9491
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.