note 55410 deleted from function.split by sean

From: Date: Tue, 02 Aug 2005 17:12:55 +0000
Subject: note 55410 deleted from function.split by sean
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-92965@lists.php.net to get a copy of this message
Note Submitter: topsub2003 at yahoo dot com Reason: bad code ---- I used this to format how it pulled prices from the database. When i insert the data into the database i make sure it has a "." otherwise this code will be buggy <? $amount = $dataPrice['price']; if(eregi("\.",$amount)) { list($dollar, $cent) = split('\.', $amount); $count = strlen($cent); if($count < '2' ) { $fcent = $cent."0"; } $final = $dollar.".".$fcent; } else { $final = $amount.".00"; } echo '$'.$final; ?>

« previous php.notes (#92965) next »