Wednesday, April 14. 2004
Rahmin Pavlovic asked: I'm trying to take a string like: 'abcd' and add a fwd slash every other char, like: 'a/b/c/d/' Any suggestions? My reply was:
$str = implode('/',preg_split('/\b|\B/',$str,-1,PREG_SPLIT_NO_EMPTY)).'/';
But Jon Baer had a better idea:
chunk_split($string, 1, '/');
|