If I have a number like: 654.3213213215, i need to get on the number before the decimal, and the 2 digits after it. Any ideas?
something like this maybe:
$d = 654.3213213215; $d = preg_replace( "/(.\d{2})\d+/", "\1" , $d );
hth stew
Hi!
Try round() function!
$foo=round(654.3213213215,2);
and you'll get 2 digits after the decimal.
<?php $r=round(3456.225342,2); echo "rr $r"; ?> returns an error Warning: Wrong parameter count for round() in C:[path]\r.php3 on line 3
Does anyone have an answer for this ?
Thanks, Red