The best data type for a variable that contains holder numbers and dashes is "-"

What is the best MySQL data type for my variable, which contains the holder numbers and dashes in it (-). Example: 1233-33214-543-5435643

I am new to StackOverflow, so whoever votes for my question, could you please explain why? Thanks

+4
source share
2 answers

Since you mention VARCHAR , it looks like you want a MySQL data type , not a PHP datatype . In this case, it looks like CHAR(26) , probably suitable for your fixed-width string, for example "5432543-88367-87366-637622".

+3
source

It depends.

If it is only available for display, and you do not need to break it, the line will be the best.

If you need to break it, create your own class, and then execute the __toString function.

+2
source

All Articles