Jump to content

[SOLVED] int() function


ababmxking
 Share

Recommended Posts

im trying to remove any other characters that aren't numbers from a $_POST.

 

$amount = intval($_POST['amount']);

 

or something along them lines.

 

sorry i guess it was intval that i was talking about not int.

but it always rounds any number above 2,147,483,647 down to 2,147,483,647. I need something that will remove anything that isnt a number but not have a maximum amount.

Link to comment
Share on other sites

Just tried it and when someone sends say 50bill it changes the amount to like 50 exactly. Im going to read the thing on php.net real quick though

 

edit

 

ok i just read through it, (im not that good with functions) but the way i read it, it adds a comma or decimal every 3 numbers, and since this is going into a database im guessing its cutting off everything after the first comma.

Link to comment
Share on other sites

This thread is more than a year old.

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.

 Share

×
×
  • 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.