Jump to content

[SOLVED] removing place values from a number - very easy Q


aebstract

Recommended Posts

I don't want to round, I need to keep my numbers pretty exact. I was using a rounding method to do this and while I was testing possibilities I ran in to a problem which is why I need to just remove the numbers now.

 

 

edit: is there an easy way to remove all characters of a string except for the first two?

Link to comment
Share on other sites

the manual will help you with the details, but you want one of round(), ceil(), float(), or number_format() depending on how you want the chopping to occur.

 

http://www.php.net is your best friend.

 

EDIT:  beaten to the punch, but you don't need to create a function.  one already exists for truncating decimals.

Link to comment
Share on other sites

I don't want to round my number though, and number format seems to only place a comma in my number. If I go that way the only thing I can see doing is to put a comma every two numbers and explode and use the first value in my array. That'd be doing a little bit more than I wanted to but at least I can do that if I have to.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.