phpversion
suggest changeIntroduction
When working with various libraries and their associated requirements, it is often necessary to know the version of the current PHP binary or of one of its extensions.
phpversion() accepts one optional extension name. If that extension is loaded and has a version, the function returns a string. If it is not loaded, the function returns false. With no argument, it returns the PHP version.
Example
print "Current PHP version: " . phpversion();
// Current PHP version: 7.0.8
print "Current cURL version: " . phpversion( 'curl' );
// A version string when the curl extension is loaded.
// false is cast to an empty string, so a missing extension still prints the label.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents