php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #36871 minmax(...) == min($max, max($min, $val))
Submitted: 2006-03-27 12:31 UTC Modified: 2006-04-03 12:53 UTC
From: zabmilenko at charter dot net Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.1.2 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zabmilenko at charter dot net
New email:
PHP Version: OS:

 

 [2006-03-27 12:31 UTC] zabmilenko at charter dot net
Description:
------------
I find myself reusing the following code to adjust numbers into a desired range and precision:

$val = min($max, max($min, round($val, $prec));

This could be more elegantly written like:

$val = minmax($val, $min, $max[, $prec]);


In my opinion.

Thank you.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-03 12:53 UTC] tony2001@php.net
I don't see how such function can be useful, if you can do the same thing with on line of code.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 05 18:01:32 2024 UTC