View Full Version : Getting PHP Version
aenigma
Oct 6th 2004, 4:45 am
Is it possible to obtain the PHP Version runtime? I mean somthing to make a code like this:
if ($phpVersion > 4.3) {
doSomething
} else {
doSomethingElse
}
So I could wirite a code that would use some things if they are present, and my code would be more portable.
T0PS3O
Oct 6th 2004, 4:53 am
<?php
phpinfo();
?>
Shows the version. Have a look on php.net to see whether it can return the version as the output to use in statements.
Actually, yuor answer seems to be here: http://uk2.php.net/manual/en/function.phpversion.php
phpversion -- Gets the current PHP version
Description
string phpversion ( void )
Returns a string containing the version of the currently running PHP parser.
Note: This information is also available in the predefined constant PHP_VERSION.
Example 1. phpversion() example
<?php
// prints e.g. 'Current PHP version: 4.1.1'
echo 'Current PHP version: ' . phpversion();
?>
Just evaluate the string in a comparison.
aenigma
Oct 6th 2004, 5:11 am
Thanks this is what I was searching.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.