Guest_imported
New member
- Jan 1, 1970
- 0
How would I go about a code that would insert a space after, say 5 characters, so if someone does 555555555555, it would show as 55555 55555 55?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function addspace($string){
$count=0;
$new="";
for($i=0;$string[i];$i++){
if ($string[i]>='a' && $string[i]<='z' || $string[i]>='A' && $string[i]<='Z' || $string[i]>='0' && $string[i]<='9'){
$new.=$string[i];
$count++;
if ($count==5){
$new.=" ";
$count=0;
}
}
}
return $new;
}
i did not tested the function, but i presume it wikll work fine.