php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #62538
Patch correct-ceil-dec-function revision 2012-07-12 07:25 UTC by soneta dot kumar at gmail dot com

Patch correct-ceil-dec-function for *Math Functions Bug #62538

Patch version 2012-07-12 07:25 UTC

Return to Bug #62538 | Download this patch
Patch Revisions:

Developer: soneta.kumar@gmail.com

function ceil_dec($number,$precision,$separator='.')
{
    $appendZero = false;
    $numberpart=explode($separator,$number); 
    $numberpart[1]=substr_replace($numberpart[1],$separator,$precision,0); 
    if($numberpart[1][0] == 0)	{ $appendZero = true;}
    if($numberpart[0]>=0)
    {$numberpart[1]=ceil($numberpart[1]);}
    else
    {$numberpart[1]=floor($numberpart[1]);}
    if($appendZero){ $numberpart[1] = (int) '0'.$numberpart[1];}	
    $ceil_number= array($numberpart[0],$numberpart[1]);
    return implode($separator,$ceil_number);
}
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Nov 29 08:05:54 2022 UTC