On 4/2/07, David Krings <[EMAIL PROTECTED]> wrote:
...
$langfile = fopen('$langfileloc', 'r');
and constantly had it fail.
...
Which makes me wonder as some long time ago we
had this nice discussion that ended with sth like "one needs only the
single quote for everything in PHP".


Ah, no. The discussion probably went along the lines of "use single
quotes for faster program execution," because, as you learned, PHP
does not need to check for and evaluate variables inside of
single-quoted strings.

But really, all you had to do was not quote at all.
$langfile = fopen( $langfileloc, 'r' );

The difference would come into play if you wanted to, say, add a file
extension to the end of $langfileloc. In that case, fopen(
$langfileloc.'.txt', 'r' ) would be infintissimally faster than fopen(
"$langfileloc.txt", 'r' ), because concatenation is supposed to be
faster than string evaluation. Hans Z. will likely point out that
fopen("{$langfileloc}.txt", 'r') is even faster, because concatenation
is too slow for some folks.

Processor speeds being what they are, the only good reason to use
single quotes is so you don't have to use the shift key while you type
your code.

--
Chris Snyder
http://chxo.com/
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to