Page 1 of 1

adding spaces to every 3rd character in a string

Posted: Fri Nov 22, 2002 3:41 pm
by mccommunity
I am trying to take a specific string $string=xfm3muedf7uy; and I am trying to find a way to add spaces after every 3 characters $string=xfm 3mu edf 7uy; What is the best way to do this? Thanks. 8O

Posted: Fri Nov 22, 2002 5:19 pm
by mydimension
chunk_split() looks like it may do the trick for ya
http://www.php.net/manual/en/function.chunk-split.php

To My Dimension

Posted: Sat Nov 23, 2002 9:13 am
by mccommunity
Hey man,

You rock.... thanks for your help. This is what I needed.


Mark :lol: