Hammad Anwer
Hammad Anwer

Reputation: 147

Put Space Between 2 Digits in Php?

I either get a one digit or a two digit number from my database like 52,8,4,99 etc. What i want to do now is to display the number with a space in between if the number is two digit like "5 2". How do i do this?

Upvotes: 0

Views: 1188

Answers (1)

Matthew
Matthew

Reputation: 48284

I believe this will do what you want:

echo join(' ', str_split($number));

Upvotes: 3

Related Questions