Testing PHP version
The following is how you test your what version of PHP looks like:
/** * @param string the minimum version of PHP required to run, e.g. '5.2.14' */ public static function php_version_gt($ver) { $exit_msg = __("MyPlugin requires PHP $ver or newer. Talk to your system administrator about upgrading"); if ( version_compare( phpversion(), $ver, '<') ) { self::$errors[] = $exit_msg; } }
Again, you would add a corresponding function call to your loader.php
file:
// Run Tests. MyPlugin_tests::wp_version_gt('3.0.1'); MyPlugin_tests::php_version_gt('5.2.14');
Get WordPress 3 Plugin Development Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.