Difference from bleeding edge server and production server where I couldn't use the phpversion() function. Came up with this to grab it from the command line instead. Note that the 'command line' version result , and 'http server api' version result could be two or more different versions, and not matching each other. So this may return a misleading value for your environment? Be careful if you have updated the web server api and not the command line, or visa-versa. ;)
But for me - it works.
<?php
$PHP_VERSION = get_my_phpver();
echo "PHP_VERSION = $PHP_VERSION<br>";
function get_my_phpver() {
$my_phpver = trim(substr(shell_exec('php -v'), 3, 6));
return $my_phpver;
}
?>
Of course this would also do the trick...
<?php
$PHP_VERSION = trim(substr(shell_exec('php -v'), 3, 6));
echo "PHP_VERSION = $PHP_VERSION<br>";
?>
And as always, there are OTHER method, but this works for me.
Hope this helps someone else out as well. :)