Re: [PHP] using explode

[email protected] (Stut)
Newsgroups php.general
Message-ID <[email protected]>
On 5 May 2008, at 20:04, Jason Pruim wrote:
> I am wondering if I can write this cleaner?
> 	$weightExplode = explode(".", $totalWeight);
> 	$explodetest = ".";
> 	$explodetest .= $weightExplode[1];
> 	$explodetest = $explodetest*16;
>
>
> I'm hoping I've missed something... Basically I just need to include  
> the "." in $weightExplode[1] before I multiply it by 16. That's the  
> only part that is confusing me right now...

$explodetest = ($totalWeight - intval($totalWeight)) * 16;

Untested but should have the same effect as your code.

-Stut

-- 
http://stut.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.