note 80330 deleted from function.phpversion by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 00:59:47 +0000 |
| Subject: | note 80330 deleted from function.phpversion by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141878@lists.php.net to get a copy of this message | ||
Note Submitter: kalle at php dot net
----
On some machines phpversion() will not return a string in this format:
major.minor.version
But rather
major.minor.version-[os manufacturer]
I experinced this on a couple of Linux variants like Ubuntu.
So don't rely on the first format, I made this function to get the "real" version
which might come in handy if you don't want the 'os manufacturer' part:
<?php
function phpversion_real()
{
$v = phpversion();
$version = Array();
foreach(explode('.', $v) as $bit)
{
if(is_numeric($bit))
{
$version[] = $bit;
}
}
return(implode('.', $version));
}
?>