473,804 Members | 3,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php bug? strange end of php file error

Why this code

<?php
function X()
{
// echo("commented ?>");
}
X();
?>

give the error
"Parse error: syntax error, unexpected $end"

???

?is into a string commented!
Sep 7 '07 #1
3 1265
On 07.09.2007 17:31 Fabio wrote:
Why this code

<?php
function X()
{
// echo("commented ?>");
}
X();
?>

give the error
"Parse error: syntax error, unexpected $end"

???

?is into a string commented!
no, it is not. There's no "strings" inside comments, comment is a stream
of characters and does take ?into account. I don't think this is a
good idea either, but so is it.

--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
Sep 7 '07 #2

"gosha bine" <st********@gma il.comha scritto nel messaggio
news:46******** *************** @read.cnntp.org ...
On 07.09.2007 17:31 Fabio wrote:
>Why this code

<?php
function X()
{
// echo("commented ?>");
}
X();
?>

give the error
"Parse error: syntax error, unexpected $end"

???

?is into a string commented!

no, it is not. There's no "strings" inside comments, comment is a stream
of characters and does take ?into account. I don't think this is a good
idea either, but so is it.
but

/* echo("commented ?>"); */

works well... :(


Sep 7 '07 #3
Fabio wrote:
"gosha bine" <st********@gma il.comha scritto nel messaggio
news:46******** *************** @read.cnntp.org ...
>On 07.09.2007 17:31 Fabio wrote:
>>Why this code

<?php
function X()
{
// echo("commented ?>");
}
X();
?>

give the error
"Parse error: syntax error, unexpected $end"

???

?is into a string commented!
no, it is not. There's no "strings" inside comments, comment is a stream
of characters and does take ?into account. I don't think this is a good
idea either, but so is it.

but

/* echo("commented ?>"); */

works well... :(

Yet again, this has nothing to do with if you have quotes inside
comments or not. "/* blah ?*/" doesn't break out of php mode, "// blah
?>" or "# blah ?>" do. A bit odd in my opinion, but this is how it's
intended to work (see Language/Comments in manual).


--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Sep 7 '07 #4

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

Similar topics

0
2038
by: Federico | last post by:
Hi all, I don't know if this topic is perhaps a little bit off-topic, anyway I have a strange problem in transforming an XML file in an HTML file using XSLT form a Java program written with NetBeans. I utilize the javax.xml.transform class and in the computer where I wrote the program all function perfectly, calling the input XML file, the XSLT stylesheets and setting where to write the output HTML.
0
328
by: Kris Vanherck | last post by:
yesterday i started getting this strange error when i try to run my asp.net project: Compiler Error Message: CS0006: Metadata file 'c:\winnt\microsoft.net\framework\v1.1.4322\temporary asp.net files\spsweb\0e3514bf\cb1844e7\assembly\dl2\3b163f 16\00452d31_84e5c301\infragistics.webui.ultrawebgrid.v3.dll' could not be found
0
1430
by: theintrepidfox | last post by:
Dear Group I came accross a very annoying behaviour of Visual Studio, giving me six hours of headache till I found the solution. This post is mainly for fellow developers for reference as it took me ages reading through tons of posts till I found an answer. However, I'm also interested why Visual Studio behaves that way. If anyone has a theorie on it please let me know.
4
7356
by: Praveen_db2 | last post by:
Hi All I am getting strange errors in my db2diag.log can any one tell me what these errors mean?? Following is the code from my db2diag.log ********************************************************************************************* 2006-02-23-17.53.12.253000 Instance:DB2 Node:000 PID:1600(db2syscs.exe) TID:440 Appid:AC10E010.J70A.00E883122250 base sys utilities sqleagnt_sigsegvh Probe:1 Database:DEVM_DB Error in agent...
1
1560
by: JoReiners | last post by:
Hello, I have a really strange problem. I'm unable to figure it out on my own. I parse very simple xml documents, without any check for their form. These files look very similar and are encoded in UTF-8. Now minidom is always able to parse these files with minidom.parse("file") . Now when fetching I use this expression: xmldoc.getElementsByTagName('DocNumb').firstChild.data.encode('latin1')
6
3475
by: tony | last post by:
Hello! I have several projects where each one build a library.(class library or window control library). Now I get some strange compile error when building the *.exe file and doesn't understand what this means. Can somebody tell me what is causing this? Do I have made some setup in a wrong way for some of my project where I build my library.
4
4978
by: Gregor Kovač | last post by:
Hi! When I'm using IMPORT with INSERT_UPDATE I sometimes get SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. I'm not sure why this happens. The problem is that I get rejected rows because of this. Best regards,
4
1146
by: Efy | last post by:
Hi, I was debugging my JavaScript in VS2005, the script probably had an error some ware (Line 25), after I fixed the error, I am trying to run the page again I am getting the same error "Illegal argument" at that same line 25. What ever I did does not help, I have closed the program, I restarted my computer, I changed the page to contain very simple html script with no js the error is still there on line 25. I deleted all lines living...
3
1840
by: Shelly | last post by:
I am encountering two strange problems. First one: I get a "server misconfiguration error", but only sometimes. It occurs on the first screen that accesses the database on a submit. This error is intermittent -- sometimes it happens and sometimes not from the same screen with the same data. Here is the error:
8
5323
by: Dox33 | last post by:
I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. (Or is this a problem in the python source?) I will explain the problem by using 3 examples. (Sorry, long email) The first two examples are behaving normal, the thirth is strange....... I wrote the following flabbergasting code: #-------------------------------------------------------------
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9579
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
10076
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...
1
7616
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
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
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
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
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.