Coding methods (was RE: [PHP-DB] gzip image files)
| From: | Andrey Hristov | Date: | Tue, 27 Nov 2001 15:28:40 +0000 |
| Subject: | Coding methods (was RE: [PHP-DB] gzip image files) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14600@lists.php.net to get a copy of this message | ||
When you use "" the parser scans the string for variables. When ' is used it is not
parsed. So you know what $variable to put,
concatenate the strings with the variable(s). I think it's a faster method. IMO, yes it seems
ugly, but I want to be faster not so
readable as a novel.
Regards,
Andrey Hristov
----- Original Message -----
From: "Boget, Chris" <Chris.Boget@wild.net>
To: <php-db@lists.php.net>; <php-general@lists.php.net>
Sent: Tuesday, November 27, 2001 5:28 PM
Subject: [PHP] Coding methods (was RE: [PHP-DB] gzip image files)
> > $filename = 'kunden/'.$name.'.png';
>
> I see this all the time and I'm curious: what takes more
> computing power (granted, either would be incredibly little
> I'm sure, just curious which requires more work by PHP)?
>
> this:
>
> $filename = "this " . $varname . " that";
>
> or this:
>
> $filename = "this $varname that";
>
> I would think the latter example but am not sure.
>
> Another question, but this is more about personal style:
>
> I almost always use the latter method in my coding practices. It
> looks cleaner and, IMO, is easier to follow especially when there
> are a number of variables involved. For those that use the former
> method, why do you? I'm not trying to be judgemental, just curious
> why people do what they do. In asking, I may actually learn some-
> thing. :p
>
> Chris
>