Doc #63165 [Com]: Error with "%.0n" for windows replacement formula of money-format

From: Date: Wed, 15 Apr 2015 17:47:39 +0000
Subject: Doc #63165 [Com]: Error with "%.0n" for windows replacement formula of money-format
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12165@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63165&edit=1 ID: 63165 Comment by: ppaisndud at gmail dot com Reported by: somadden at gmail dot com Summary: Error with "%.0n" for windows replacement formula of money-format Status: Open Type: Documentation Problem Package: Documentation problem Operating System: window 7 PHP Version: Irrelevant Block user comment: N Private report: N New Comment: This a problem with user notes. Previous Comments: ------------------------------------------------------------------------ [2012-09-26 17:14:05] somadden at gmail dot com Description: ------------ --- From manual page: http://www.php.net/function.money-format --- In the user posted formula for windows replace: $right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits']; with: $right = (trim($fmatch[4]) || trim($fmatch[4]) === '0' ) ? (int)$fmatch[4] : $locale['int_frac_digits']; Test script: --------------- echo money_format('%.0n', 20000); Expected result: ---------------- 20000 Actual result: -------------- 20000.00 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63165&edit=1

« previous php.doc.bugs (#12165) next »