Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72165 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10894 invoked from network); 4 Feb 2014 03:40:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2014 03:40:09 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.54 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.54 mail-la0-f54.google.com Received: from [209.85.215.54] ([209.85.215.54:52212] helo=mail-la0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/10-09069-71160F25 for ; Mon, 03 Feb 2014 22:40:08 -0500 Received: by mail-la0-f54.google.com with SMTP id y1so6209785lam.27 for ; Mon, 03 Feb 2014 19:40:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=8gZaNmC7/7+27XPqGhMvP0BWhxJ5/QISIYhP1RJcXbs=; b=e/L7LwfIJzPx1zM9rj7Ha/mS6p4Yfc2mo6zxluxw6EO+K+2wdxPi3Co2Ep0PYJ5Cen Z4wwjDGigK5MwDdgJ66dbBGi2hfUN/boGEkkEcO6zjlwi8KPKTqxLJ5JfJkI6txKill5 7H8cHar4Hi1N3McNScmGzwBGLTrsGdQ2aspU+9diBAhoG8v0YtGDWKkHBlT4EWg85DsM CzI0T0+ZgCOcdD8/SFRVbDym1pQjN8AGc6+ZOa3ghbMvas9VxxxuvVK65jKP1kYVX35S NMhMOArXxmljNmYtXbHJLbwtP0Yc+MOw9EbhNfbTv61auBEUaed7i1ObohskXUsiqFqf uOfg== X-Received: by 10.152.22.1 with SMTP id z1mr92020lae.39.1391485204733; Mon, 03 Feb 2014 19:40:04 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.199.37 with HTTP; Mon, 3 Feb 2014 19:39:24 -0800 (PST) In-Reply-To: <1391465381.17454.3.camel@guybrush> References: <1391465381.17454.3.camel@guybrush> Date: Tue, 4 Feb 2014 12:39:24 +0900 X-Google-Sender-Auth: d3Op5axtjgy_I8aKTTjKXSTslpo Message-ID: To: =?UTF-8?Q?Johannes_Schl=C3=BCter?= Cc: Sara Golemon , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e0158b93856a35f04f18c651d Subject: Re: [PHP-DEV] Declare minimum PHP version required? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e0158b93856a35f04f18c651d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Johannes, On Tue, Feb 4, 2014 at 7:09 AM, Johannes Schl=C3=BCter wrote: > On Tue, 2014-02-04 at 04:46 +0900, Yasuo Ohgaki wrote: > > I may be worried to much, but I don't like run time environment checks > > which evaluated over and over. There are many codes that checks PHP > > version, loaded extension, library version, etc to make sure code works > as > > it should be. Perhaps, more generic form might be better > > > > declare('requirements') { > > if (version_compare(PHP_VERSION, '5.6.0', '<')) { > > echo 'You need PHP 5.6.0 or later'; > > return FALSE; > > } > > if (!extension_loaded('foo')) { > > echo 'You need foo extension'; > > return FALSE; > > } > > // and so on > > return TRUE; > > } > > > > That still has to run each time the file is included. Zend engine does not have to store byte codes of declare block as it is compiler directive. It would be beneficial with byte code cache. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e0158b93856a35f04f18c651d--