Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72139 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63424 invoked from network); 3 Feb 2014 22:09:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2014 22:09:51 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:58500] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/29-35654-CA310F25 for ; Mon, 03 Feb 2014 17:09:50 -0500 Received: from [192.168.2.31] (ppp-88-217-73-203.dynamic.mnet-online.de [88.217.73.203]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id 0A4E13FED6; Mon, 3 Feb 2014 23:10:23 +0100 (CET) To: Yasuo Ohgaki Cc: Sara Golemon , "internals@lists.php.net" In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Mon, 03 Feb 2014 23:09:41 +0100 Message-ID: <1391465381.17454.3.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Declare minimum PHP version required? From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) 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. johannes