PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Your problem is not the semi-colon, it's the double quotes. If " starts the string and " ends it, do you see a major issue with your code? Hint: Look at the highlighted version in your post Hint 2: \ is the escape character.
Of course, reading the manual on strings would help you understand what is happening. You have two choice here, once is use double quote around your string, which PHP will treat as a string that needs interpretation and scan it for vars (and which will also require escaping of other double quotes in the srring) or use single quotes (to make the string a literal string) and be done with it. Since there is no PHP in the string you are echoing, wrap that puppy in single quotes and make it a literal.
Everah wrote:Single quotes around your markup attributes is also invalid markup, under stricter DTD's.
Really? Which ones?
According to http://www.w3.org/TR/html4/intro/sgmltut.html
"By default, SGML requires that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39). Single quote marks can be included within the attribute value when the value is delimited by double quote marks, and vice versa."
Obviously SGML comes higher up the chain and its specifications certainly cannot be modified by a mere DTD.
The following mark-up validates just fine under the W3C validator:
You know, I may be wrong. It might just be that they need to be quoted, not necessarily double-quoted. I know I read it somewhere, but I cannot find that somewhere for the life of me.
As a general rule, I double-quote my attributes all the time, without exception. But that is kinda my way of doing things, and until I find the place where it says it is required, it is only a preference, not a requirement.
I believe the enormous bias towards double quoted attributes (almost 100%) has come about due to poor support of single quoted attributes by some early user agents.