phpversion

PHP 4, PHP 5, PHP 7, PHP 8
phpversion - Gets the current PHP version
Manual
Code Examples

phpversion( [string|null$extension = null] ): string|false

Returns a string containing the version of the currently running PHP parser or extension.

Parameters

extension

An optional extension name.

Return Values

Returns the current PHP version as a string. If a string argument is provided for extension parameter, phpversion returns the version of that extension, or false if there is no version information associated or the extension isn't enabled.

Notes

Note:

This information is also available in the predefined constant PHP_VERSION. More versioning information is available using the PHP_VERSION_* constants.

Changelog

Version Description
8.0.0 extension is nullable now.

Related Functions

Example of phpversion

Show all examples for phpversion

PHP Version: