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