hi, I'm new to PHP.
I want to change display_errors to On for debugging, but see many PHP versions installed.
I thought going to http://localhost/first/index.php?language=English&page=phpinfo would give me the version , but it just renders the regular index page.
Ty.
$version = phpversion();
print $version;
Documentation
However, for best practice, I would use the constant PHP_VERSION. No function overhead, and cleaner IMO.
Also, be sure to use version_compare() if you are comparing PHP versions for compatibility.
Technically the best way to do it is with the constant PHP_VERSION as it requires no function call and the overhead that comes with it.
php 5
echo $PHP_VERSION;
That does not work in 7+ however, you can use:
php7.x
echo PHP_VERSION;
Not sure about php8.x though. constants are always faster then function calls.