note 10207 added to sprintf

From: Date: Tue, 19 Dec 2000 13:48:00 +0000
Subject: note 10207 added to sprintf
Groups: php.notes 
Request: Send a blank email to php-notes+get-8917@lists.php.net to get a copy of this message
Can srintf do the following? // Return Prices Pointed: // 1234,556 -> 1.234,55 function rpp($val) { $comma=strpos($val,","); if ($comma!=0) { $ta=substr($val,0,$comma); $b=substr($val,$komma+1,2); // cutted 2 digits! } else { $ta=$val; $b="00"; } // if $a=substr(strrev(chunk_split(strrev($ta),3,".")),1); return "$a,$b"; } // rpp http://www.php.net/manual/function.sprintf.php

« previous php.notes (#8917) next »