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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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: Sun Jun 02 02:01:29 2024 UTC