Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48345 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39782 invoked from network); 19 May 2010 11:04:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2010 11:04:49 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.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: rquadling@googlemail.com X-Host-Fingerprint: 209.85.211.177 mail-yw0-f177.google.com Received: from [209.85.211.177] ([209.85.211.177:50533] helo=mail-yw0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/C0-34085-CC5C3FB4 for ; Wed, 19 May 2010 07:04:45 -0400 Received: by ywh7 with SMTP id 7so4223550ywh.26 for ; Wed, 19 May 2010 04:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:mime-version:received:reply-to :in-reply-to:references:from:date:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=F3+DFDs+mcyhI/fOZHga6l25trVVUM55PAhANR4LFsc=; b=PVRxWMNr/c2Jau+qMt1dbIZ8EVlz1ff+ZG0wnFD4+RZlxDoV2VZx3UBMryKZ/BBYGg AIxTuOs0Vyk4WWUhqePsjXQ1twXIg1idmGIADKIvCVNHyk+cwkVk24ArBmu6UT5ZQYSV iYEeNw0zTdpJbog9QJswHhEii7xQGoKV6arPU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; b=FFpPoHTl0LAB5o7NGTr+PAfypD4ZcjmaulgMCUT3qi5hLZwRvtTuso5M/vdq2XC6lY oq8aFHZDSrbxLlsac72MZUJvKLH2A99/PvGrgrIkZe2AfdIAuZUZ3idxJshTq7+zEW+X PUdbvsCgymRl8dyGb8s0qTgq8iMZV3Ua05egI= Received: by 10.101.143.19 with SMTP id v19mr10305688ann.125.1274267081742; Wed, 19 May 2010 04:04:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.45.17 with HTTP; Wed, 19 May 2010 04:04:20 -0700 (PDT) Reply-To: RQuadling@googlemail.com In-Reply-To: References: <4BF3A72B.8020903@mageekbox.net> <4BF3B4E2.5070209@mageekbox.net> Date: Wed, 19 May 2010 12:04:20 +0100 Message-ID: To: Tjerk Anne Meesters Cc: Frederic Hardy , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Constant and expression ? From: rquadling@googlemail.com (Richard Quadling) 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 { >>>> =C2=A0 =C2=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" >> =C2=A0keyword can't do, even if "const" keyword evaluation is done at co= mpilation >> 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=C3=A9d=C3=A9ric Hardy : Architecte d'application/Admin. syst=C3=A8me/= Ergonome >> =C2=A0 =C2=A0 =C2=A0 =C2=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? Regards, Richard. [1] http://shwup.blogspot.com/2010/04/about-constants.html [2] http://docs.php.net/manual/en/ini.sections.php --=20 ----- 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=3D213474= 731 ZOPA : http://uk.zopa.com/member/RQuadling