[KLUG Members] PHP & HTML
bill
members@kalamazoolinux.org
Fri, 20 Feb 2004 09:15:44 -0500
I've found PHP so fast that most recommended speed improvements are only
mythological. I tried the single quote method for a while but found
that too often I needed to change a string to a variable and the line
wouldn't work.
I use double quotes almost all the time for the same reason I use PHP
almost all the time, easier scanning, maximum flexibility.
By far the worst line to scan is a line that mixes both types of quotes.
echo( '<p>This is your name:' . $firstname . " " . $lastname . "</p>\n");
is harder to read than
echo "<p>This is your name: $firstname $lastname</p>\n";
kind regards,
bill
Richard Harding wrote:
> I work around this by using a single quote to encase the html. It does
> two things for me. First, PHP looks in every double quote string for
> variables that it needs to replace. This takes time to read every
> string. PHP does not perform this same find/replace on single quoted
> strings. It reduces some overhead. Secondly, it solves the problem of
> having to escape the quotes.
>
> So a line like:
> echo( "This is your name: $name" );
>
> becomes
> echo( 'This is your name:' . $name );
>
> I find it a bit cleaner and it has the speed benefit.
>
> Rick
> _______________________________________________
> Members mailing list
> Members@kalamazoolinux.org
>
>
>