March 2011
Beginner to intermediate
300 pages
7h 23m
English
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');Read now
Unlock full access