Bug #14704 Updated: phpversion (bool Float) request
| From: | jimw@php.net | Date: | Mon, 29 Apr 2002 00:00:43 +0000 |
| Subject: | Bug #14704 Updated: phpversion (bool Float) request | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-6386@lists.php.net to get a copy of this message | ||
ID: 14704
Updated by: jimw@php.net
Reported By: roberto@berto.net
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: all
PHP Version: 4.1.0
New Comment:
you need to use version_compare() to compare versions. (they aren't
always entirely numeric.)
Previous Comments:
------------------------------------------------------------------------
[2001-12-26 15:20:05] roberto@berto.net
Look:
<?PHP
// return 4.1
print (float)PHP_VERSION;
$v = 4.1.4;
// return 4.1
print (float)$v;
?>
If someone wants to compare the versions of PHP, so he need to create a
preg-like routine to change the string of PHP version to double
numbers.
So, you can rewrite in C the phpversion to
function phpversion($withFloat = FALSE) {
if ($withFloat == TRUE) {
return 4.14;
}
return "4.1.4";
}
So, if someone want a float number, he will call phpversion(1);
<?PHP
// output 4.14
print phpversion(1);
// output 4.1.4
print phpversion();
?>
Thanx.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=14704&edit=1