php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2676 min() and max() behavior changed?
Submitted: 1999-11-06 20:57 UTC Modified: 1999-11-22 20:29 UTC
From: leon at leonatkinson dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0 Beta 2 OS: windows
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: leon at leonatkinson dot com
New email:
PHP Version: OS:

 

 [1999-11-06 20:57 UTC] leon at leonatkinson dot com
<?
  print(min(1, 17, 3, 5.5, "hello") . "<BR>\n");
  print(max(1, 17, 3, 5.5, "hello") . "<BR>\n");
?>

Under PHP 3.0.12 this generates:

1
hello

Under PHP 4b2 this generates:
hello
17

It looks like min and max are always comparing elements by their double value.  If there are any string values in the list, the comparison should be made alphabetically.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-22 20:29 UTC] andrei at cvs dot php dot net
This was fixed for Beta 3.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 20 23:00:02 2025 UTC