Posted By

rave on 10/02/10


Tagged

String strings cut smaller Delimiter


Versions (?)

Cut String and add delimiter


 / Published in: PHP
 

It takes a String and adds a delimiter after every [length] characters.

  1. function cutAt($string,$length, $delimiter){
  2. if(strlen($string) > $length)
  3. {
  4. $one = substr($string,0,$length);
  5. $two = cutAt(substr($string,$length));
  6. return $one.$delimiter.$two;
  7. }else{
  8. return $string;
  9. }
  10. }

Report this snippet  

You need to login to post a comment.