note 55410 added to function.split

From: Date: Tue, 02 Aug 2005 16:57:04 +0000
Subject: note 55410 added to function.split
Groups: php.notes 
Request: Send a blank email to php-notes+get-92964@lists.php.net to get a copy of this message
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; ?> ---- Manual Page -- http://www.php.net/manual/en/function.split.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55410 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55410&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55410&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55410&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55410&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55410&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55410&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55410&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#92964) next »