W liście Arvids Godjuks z dnia środa 29 października 2008:
> People, when you will start to learn that such approach is a mess?
> First, use ' ' instead of " " and format your SQL better and you woun't
> have any problems:
>
> <?php
> define ('STATUS_ACTIVE', 1);
> define ('NUM_PER_PAGE', 25);
> $q = 'SELECT
>     ID, Name
> FROM Projects
> WHERE StatusID = '.STATUS_ACTIVE.'
> LIMIT '.NUM_PER_PAGE.', '.$offset;
> $res = mysql_query ($q);
> ?>

It's almost the same as original poster's version (except for $offset).
> a). It's more readable without syntax highlighting
> b). It's just faster.
> c). It's a good style.
> d). I think if that is easy to do, it would be implemented a long time ago.
With regard to a and c - this is just your opinion, others might find it less 
readable (or indifferent). And for b - speed difference between ' and " 
should be negligable (esp. with opcode caches).

I only worry it could break BC - people might have used "{SOMETEXT}" in 
strings and not expect it to be interpolated (I've done so myself).


-- 
Paweł Stradomski

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to