Hi Sara,
On Tue, Feb 4, 2014 at 3:14 AM, Sara Golemon <[email protected]> wrote:
> On Sun, Feb 2, 2014 at 10:58 PM, Yasuo Ohgaki <[email protected]> wrote:
> > I thought it might be good for us to have declaring minimum PHP version
> > required to execute script.
> > http://jp1.php.net/manual/en/control-structures.declare.php
> >
> > Something like
> > <?php
> > declare(php_version>='5.6.0');
> > // or PHP_VERSION_ID? using = as minimum as it could be a little faster
> > // and no change in declare() syntax.
> > declare(php_version=50600);
> >
> While I like it from a formality stand-point, I have to agree with
> Stas. The is entirely doable as PHP code right now. Include time IS
> execute time. And if you're concerned with a single integer compare
> in your perf analysis, you're probably worried about the wrong thing.
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;
}
for example.
Regards,
--
Yasuo Ohgaki
[email protected]