Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- The Natural Philosopher
July 23, 2010, 1:47 pm
well each to his own. HTML needs double quotes in form varaibles and in
all the tag statements, so that wring for a start.
And printf encapsulates ALL the formatting you EVER need in one function.
To convert an integer to a precisely two SD floating point for currency,
And it was written by C programmers, who probably wanted a better way to
do what FORTRAN had done, already.
I dont think COBOL had anything to do with it,.
On Fri, 23 Jul 2010 14:47:49 +0100, in comp.lang.php The Natural
Correction: HTML will be happy with
<img src=pic1.jpg width=80 height=40 alt=pic1 title=pic1>
<img src="pic1.jpg" width="80" height="40" alt="pic1" title="pic1">
<img src='pic1.jpg' width='80' height='40' alt='pic1' title='pic1'>
The only time you need quotes (single or double) is if there is spaces
within the text or slashes.
<img src="images/pic1.jpg" width=80 height=40 alt="pic 1" >
<img src='img/pic1.jpg' width=80 height=40 alt='pic 1'>
XHTML requires that all attributes be enclosed in quotes.
(s)printf() is a very powerful function, if you use it properly. Even
v(s)printf() can be really cool and efficient in some situations.
Exactly. It does the same as a parameterized query to a DB.
Correct, but this separation gives you new features and much more
Of course you as the programmer should know what kind of values you're
working with. Don't blame your sloppiness on the language or one of its
You'll receive a warning.
Now add escaping to $a to prevent XSS attacks, ensure $b comes out as a
float in scientific notation and make $c completely conditional, but
still escaped. Then add a $d with the same value and behaviour like $c.
Still far easier?
In real examples for a real website using only echo/print is not always
the best way.
On 23/07/10 16:46, Michael Fesser wrote:
Then you loop through the result of a query, generating table rows for a
shopping cart where the table is inside a form, with maybe increment /
row total, row price, order price, hidden fields, onkeyup event
listeners for the quantity field in case the user types a quantity in
instead of using the inc / dec / delete buttons etc ....
function call parameter inside a quoted html element event attribute
inside a php string, and almost any way you go at it, that's three
levels of quotes so you have to escape some of them:
So which do you use:
value=' + '
value=\" + \"
value=" + "
or something else ....
Actually, according to the ECMAScript standard, "A string literal
is zero or more characters enclosed in single or double quotes"
- The Natural Philosopher
July 23, 2010, 2:07 pm
On 07/23/2010 05:09 AM, rf wrote:
For example... go to google, cnn, wikipedia and look at the source code.
which one is the most used?
Those sites are just as example, there may be a number of others that
just use single quotations mark. that means nothing.
If you look at html authoring software. by default they use double quotes.
I did not even mention anything about this.
We are not talking about PHP in this topic.
For your keyboard maybe. thinking that way I could then say that a
double quotation mark has a lower value in ASCII than a single one.then
it could be better to use it.
Just discussing nonsense.