II - D - Apostrophes or quotation marks ?
II - D - 1 - What I do not advise :
If you are a little lazy, you will find handy to know that the quotes "" (as opposed to single quotes or apostrophes) allow this in PHP:
So you may find it a little twisted to use single quotes for PHP therefore, because the example above rule in a single shot ladle the problem of the direct interpretation of the variable and the problem of the apostrophe text "I have" ...
However, I think you will need more rigorous if you need to continue with PHP, so I beg you to adopt the following convention, at least for this tutorial:
II - D - 2 - My advice :
In the future, you will frequently produce HTML with your PHP code, since it is its essential function. Thus by adopting the following convention, you'll always know if you are at PHP or HTML.
When you use a ' : it is in PHP.
When you use a " : it is in HTML.
For clarity of your ideas, so I advise this :
Of course, you still have the blow to the reflex:
Attention in the contents of my HTML, between two tags, if I have an apostrophe in my text (which is actually quite rare):
I must think of the escape character.
But it should not pose major problems, all sentences not containing as many quotes as in the example below ...










0 comments:
Post a Comment