Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48355 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5267 invoked from network); 19 May 2010 14:57:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2010 14:57:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.211.177 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.211.177 mail-yw0-f177.google.com Received: from [209.85.211.177] ([209.85.211.177:43745] helo=mail-yw0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 85/00-04985-A5CF3FB4 for ; Wed, 19 May 2010 10:57:31 -0400 Received: by ywh7 with SMTP id 7so4393337ywh.26 for ; Wed, 19 May 2010 07:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=Pyp/wu1JdiJA6F3MLJzD+s4FFMYGZS6jCj966+F6a2o=; b=KAs9zh9Iik+Jn8glK64q5MbA+oeduYwEc8HyLlyCF/nmomjSnAgz11cUvxubX8NjhP p+zEhWTG4HsQ6nZeH3eTwyEqQb0V0dTFEIxbD484nr2367K7hWaOdKrk66RMSkqLV77o Ns4JwGrEBVM8+iX20X3nddNjYk96iNFI7s1EQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=fN63/BZAEv9seO39yNchlDNCu16RfnwoluHsdFKtKjk0hU5MxFVMHOMPKxmmeAa8yW TFsaZFdGvNzslUG+3ILMBPPBNW3IvnUj8Yldz//+IMsFPRTieLKFwctcna66c+YoLDa/ 6Dg0YuxOE1nDCVvv5tjO8b2Q17lCWQ0IqMeDk= MIME-Version: 1.0 Received: by 10.150.237.19 with SMTP id k19mr9363316ybh.393.1274281048074; Wed, 19 May 2010 07:57:28 -0700 (PDT) Sender: tjerk.meesters@gmail.com Received: by 10.150.51.15 with HTTP; Wed, 19 May 2010 07:57:27 -0700 (PDT) In-Reply-To: References: <4BF3A72B.8020903@mageekbox.net> <4BF3B4E2.5070209@mageekbox.net> Date: Wed, 19 May 2010 22:57:27 +0800 X-Google-Sender-Auth: 3ITgJRWudQbGBvMcG39DbdYgXVM Message-ID: To: RQuadling@googlemail.com Cc: Frederic Hardy , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Constant and expression ? From: datibbaw@php.net (Tjerk Anne Meesters) On Wed, May 19, 2010 at 7:04 PM, Richard Quadling wrote: > On 19 May 2010 11:21, Tjerk Anne Meesters wrote: >> On Wed, May 19, 2010 at 5:52 PM, Frederic Hardy >> wrote: >>> Hello ! >>>> >>>> AFAIK class constants are optimized for speed and therefore don't >>>> support expressions; don't expect this to change any time soon ;-) >>>> >>>>> Is there any feature request about constant and expression ? >>>>> I would like to write something like that : >>>>> >>>>> >>>> >>>>> namespace foo\bar\directories { >>>>> =A0 =A0const tmp =3D __DIR__ . '/tmp'; >>>>> } >>>>> >>>>> ?> >>> >>> So the best solution is something like >> define('foo\bar\directories\tmp', __DIR__ . '/tmp'); ?>... >>> It 's strange that "define()" function can do something that the "const= " >>> =A0keyword can't do, even if "const" keyword evaluation is done at comp= ilation >>> time and "define()" evaluation is done at runtime. >> >> That's why there's a cost penalty to using define(). >> >> I wrote a small article that gives an idea of the speed differences: >> http://shwup.blogspot.com/2010/04/about-constants.html >> >> >>> >>> Best regards, >>> Fred. >>> >>> -- >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> Fr=E9d=E9ric Hardy : Architecte d'application/Admin. syst=E8me/Ergonome >>> =A0 =A0 =A0 =A0Status : En recherche d'emploi >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> >>> >> >> >> >> -- >> -- >> Tjerk > > With regard to HiDef and the hidef.ini_path setting, and the comment > on [1] regarding "However, all this goodness comes with a drawback: > configuration settings are instance wide, which impacts all setups of > PHP that runs beyond a single web request (e.g. Apache module or > FastCGI).", could the ini entry be placed in a ... > > [HOST=3D] > > section in the ini file? [2] > > If so, could this be the best solution? The speed of hidef is accomplished by having only MINIT and MSHUTDOWN handlers; it would be interesting to see how speed is affected by moving some logic to the request init/shutdown; it should still have the benefit of constants being defined at compile time. > > Regards, > > Richard. > > [1] http://shwup.blogspot.com/2010/04/about-constants.html > [2] http://docs.php.net/manual/en/ini.sections.php > > -- > ----- > Richard Quadling > "Standing on the shoulders of some very clever giants!" > EE : http://www.experts-exchange.com/M_248814.html > EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp > Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D2134= 74731 > ZOPA : http://uk.zopa.com/member/RQuadling >