Any idea why this is considered bad practice?
Yes. Their are several things I can think of right away:
* People often mix double & single quotes in one project: using
inline variables can easily cause bugs if the programmer doesn't
remember that they won't work inside his single quoted strings
* When looking at a large piece of PHP code, inline variables are
harder to spot and some less advanced syntax highlighters don't
recognize them -> Readability
* Consistency: If you use single & double quotes then not using
inline variables will make for a more consistent code base
* Function wrapping: When using inline variables, you can't wrap
them with a function call. So this makes it more work to add those
calls later on, which often causes lazy developers to skip data
sanitation (big issue with XSS attacks)
Those are the reasons that just came to my head, but I'm sure there are
a couple others as well.
-- Felix
--------------------------
http://www.thinkingphp.org
http://www.fg-webdesign.de
Jörn Zaefferer wrote:
Felix Geisendörfer schrieb:
Just a quick input on the PHP variables,
Here comes another one: Using the $str = "My string with an inline
$variable. Oh no!"-syntax is generally thought of as a bad practice by
many PHP folks (including me).
Any idea why this is considered bad practice?
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/