Ask about general coding issues or problems here.
Moderators: macek, egami, gesf
I would require help to convert a string number to integer but the value must remain same. For ex:
- Code: Select all
This above prints 2147483647
. But I want to print the exact value as entered in $str
variable but should be of integer type.
Thanks in advance,
- New php-forum User
- Posts: 1
- Joined: Mon Oct 15, 2012 1:37 pm
Use a data type large enough to hold the number and you won't have a problem. For int your threshold is around 2 billion. if you use float or double, you expand the size of the container and it works properly.
- php-forum Fan User
- Posts: 679
- Joined: Mon Oct 01, 2012 12:32 pm
Return to PHP coding => General
Who is online
Users browsing this forum: No registered users and 5 guests