I’m trying to get the php version in the form PHP_MAJOR_VERSION.PHP_MINOR_VERSION :
$ php -r 'print $PHP_MAJOR_VERSION.$PHP_MINOR_VERSION;'
PHP Warning: Undefined variable $PHP_MAJOR_VERSION in Command line code on line 1
PHP Warning: Undefined variable $PHP_MINOR_VERSION in Command line code on line 1
$
This doc says :
These constants are defined by the PHP core.
How can I load them ?
2
Answers
This will do it.
if you want to see in your command line then php –version will show you php version.
if you want display major and minor separately you should use this example described in —
https://www.php.net/manual/en/function.phpversion.php
if you need exact code after trying this. then tell me..