How to check how many characters in variable, and add space between characters in that var?
- by Camran
I have a 'price' variable that contains some integer number from a MySQL database.
I want to check how many numbers the 'price' variable contains, and add a space in the variable depending on how many numbers. See below:
Example:
If 'price' is 150000 I would like the output to be 150 000 (notice the space).
OR, if it is 19000 I would like it to output 19 000...
How would you do this the easiest way?