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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 10:01:34 2025 UTC