Re: Number_Format Question

From: Date: Sun, 04 Nov 2001 05:05:07 +0000
Subject: Re: Number_Format Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-73373@lists.php.net to get a copy of this message
"Jeff Oien" <jeff@webdesigns1.com> wrote: > I have a number like this 0.51 and I would like it to display without > the leading 0. How can I do this? Thanks. There are lots of solutions. $num = 0.51; $num_parts = explode( '.', $num ); $num_new = '.' . $num_parts[1]; Or if it's always going to be a number b/w 0 and 1 then you could use substr() to get the part you want. You could also use something like ereg_replace(). Someone else may have a solution that's better. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/

« previous php.general (#73373) next »