Re: Declare minimum PHP version required?
| From: | Yasuo Ohgaki | Date: | Tue, 04 Feb 2014 03:39:24 +0000 |
| Subject: | Re: Declare minimum PHP version required? | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-72165@lists.php.net to get a copy of this message | ||
Hi Johannes,
On Tue, Feb 4, 2014 at 7:09 AM, Johannes Schlüter <johannes@schlueters..de>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