Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41548 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19201 invoked from network); 29 Oct 2008 09:01:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Oct 2008 09:01:33 -0000 Authentication-Results: pb1.pair.com header.from=pstradomski@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pstradomski@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.78.26 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pstradomski@gmail.com X-Host-Fingerprint: 74.125.78.26 ey-out-2122.google.com Received: from [74.125.78.26] ([74.125.78.26:8600] helo=ey-out-2122.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AB/AC-48169-B6628094 for ; Wed, 29 Oct 2008 04:01:33 -0500 Received: by ey-out-2122.google.com with SMTP id 5so1092487eyj.59 for ; Wed, 29 Oct 2008 02:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:reply-to:to:subject:date :user-agent:cc:references:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:message-id; bh=gi3oowMAi1YoVPprgNENzhO3xzWIxMTLqLuQPPLamUc=; b=ablA1+rXZGTdy0sRJ77EueAxuwh2PE5cPfg3KzkDpxkeRyXkal8q7qOSzUjmncJyni IO1KVzcKmeWwU9r3BokbkYRYrR4Bn198xwce/HW6A1wA9X+ZpcPr1dgFqxy3FxUkzxpm uFBVknm8UTnCgoh2UKbFlZToYWw/ERYJPem7E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:message-id; b=X1CjwqDNd5oAhTbYtdhQj37ikSh4sX7Mes9WnqXgPPJ32VQbewg2ULyNkv3tC6pLU2 sKi1n/8m8N5gh6SrBJo3OAM1dHECAp99h/B/LCr1X4/dZvQ3M90HuUdGrEY6GO1XObu0 VppcBNL+sZukzFnxeh5j9Z1/qfc4vOLp3miZo= Received: by 10.86.3.4 with SMTP id 4mr5394976fgc.44.1225270888674; Wed, 29 Oct 2008 02:01:28 -0700 (PDT) Received: from charon (bra.telnet.krakow.pl [91.196.215.2]) by mx.google.com with ESMTPS id d6sm3427998fga.2.2008.10.29.02.01.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 29 Oct 2008 02:01:27 -0700 (PDT) Reply-To: =?utf-8?q?Pawe=C5=82_Stradomski?= To: internals@lists.php.net Date: Wed, 29 Oct 2008 10:01:47 +0100 User-Agent: KMail/1.9.9 Cc: "Arvids Godjuks" , Josh References: <6fef9b880810282117v569d3064l752902daaa285a25@mail.gmail.com> <9b3df6a50810282353oaedfde5qf62df50876760170@mail.gmail.com> In-Reply-To: <9b3df6a50810282353oaedfde5qf62df50876760170@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-ID: <200810291001.47422.pstradomski@gmail.com> Subject: Re: [PHP-DEV] Constants in double-quoted strings From: pstradomski@gmail.com (=?utf-8?q?Pawe=C5=82_Stradomski?=) W li=C5=9Bcie Arvids Godjuks z dnia =C5=9Broda 29 pa=C5=BAdziernika 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: > > define ('STATUS_ACTIVE', 1); > define ('NUM_PER_PAGE', 25); > $q =3D 'SELECT > ID, Name > FROM Projects > WHERE StatusID =3D '.STATUS_ACTIVE.' > LIMIT '.NUM_PER_PAGE.', '.$offset; > $res =3D 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 ag= o. With regard to a and c - this is just your opinion, others might find it le= ss=20 readable (or indifferent). And for b - speed difference between ' and "=20 should be negligable (esp. with opcode caches). I only worry it could break BC - people might have used "{SOMETEXT}" in=20 strings and not expect it to be interpolated (I've done so myself). =2D-=20 Pawe=C5=82 Stradomski