note 30778 deleted from function.ereg by vincent
| From: | vincent@php.net | Date: | Sat, 30 Aug 2003 19:32:42 +0000 |
| Subject: | note 30778 deleted from function.ereg by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55359@lists.php.net to get a copy of this message | ||
Note Submitter: :: h0nk - ace@ogbrozzas.de ::
----
check da $price input wid da following regex.
if (ereg ('^0|[1-9][0-9]*|[1-9][0-9]*[.][0-9]{1,2}$', $price)) {$price ;}
else {print "!!! ERROR !!!" ;}
this regex allows u 2 set a standalone "0" OR an integer value OR an decimal value.
u can format da output with - printf ("%0.2f", $price) -
to get da right format for $money$ like this - 0.00 -
visit me @ www.ogbrozzas.de and IRC #OGz @ Quakenet