phpversion()
Know what version of PHP is running by calling this function. You’ll get back a string which could be used to compare against a requirement, for example.
You can also use it to get the version number of an extension. Simply pass the extension name as the parameter and you’ll either get its version number, or false if it has no associated version information or the extension isn’t enabled.
So now, with this function, you can check server requirements before install, or suggest upgrading.
Note: the PHP version number is also available in the predefined constant PHP_VERSION.
$ver = phpversion(); // 5.2.5 (for example) $ver = PHP_VERSION; // same as the above $jsonVer = phpversion('json'); // 1.2.1 (for example) $imagickVer = phpversion('imagick'); // false (extension not installed)
