note 48564 deleted from function.array by nlopess

From: Date: Wed, 29 Dec 2004 21:28:28 +0000
Subject: note 48564 deleted from function.array by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-82469@lists.php.net to get a copy of this message
Note Submitter: eduardo at minicom dot com dot br ---- As my need, I've made a function that scan the assoc. array and format every row that is numeric, otherwise dont make nothing. In this example, the function format in Brazillian way, its all about to change it :) <?php function numFrmtAssoc($arrNum){ foreach ($arrNum as $key=>$value){ foreach ($value as $keyAssoc=>$valueAssoc){ if(is_numeric($valueAssoc)) $value[$keyAssoc] = number_format($valueAssoc,'2',',','.'); else $value[$keyAssoc] = $valueAssoc; } } $buffArr[] = $value; return $buffArr; } //usually this array come from a resultset from a database $arr = numFrmtAssoc($AnyAssocArray); echo "<pre>"; print_r($arr); echo "</pre>"; ?> ---- Reason: useless example

« previous php.notes (#82469) next »