Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I am trying to store a phone number and I have reached some problems due to type casting? Anyone have any suggestions as to what is happening here?
var_dump((int)"6467838439"); // displays 'int 2147483647'
1 to 2147483647
6467838439
float
Phone numbers should be stored as text. They generally can't be stored as integers due to integer overflow.
Add a comment
An integer is 32 bits and has a finite size of approximatly 2 billion so your phone number is being truncated. You should store it as a string.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
1 to 2147483647and you have6467838439. So when you try to convert it in integer type it is converted to the maximum range of int which is 2147483647. You can only store it as stringfloateither.