php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #14704 phpversion (bool Float) request
Submitted: 2001-12-26 15:20 UTC Modified: 2002-04-28 20:00 UTC
From: roberto at berto dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.1.0 OS: all
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: roberto at berto dot net
New email:
PHP Version: OS:

 

 [2001-12-26 15:20 UTC] roberto at berto dot 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-28 20:00 UTC] jimw@php.net
you need to use version_compare() to compare versions. (they aren't always entirely numeric.)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 21:01:27 2024 UTC