Contributing to PHP functions list
| From: | flybybetto | Date: | Thu, 24 Jun 2004 20:33:15 +0000 |
| Subject: | Contributing to PHP functions list | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-25113@lists.php.net to get a copy of this message | ||
I always look for a function in php like this...
maybe it help other
//Insere uma string na posição desejada
Inserts a string at desired position
function ins_str($str,$chr,$pos){
if ($pos > 0){
$str = substr($str,0,$pos).$chr.substr($str,$pos);
}elseif($pos < 0){
$str = substr($str,0,$pos).$chr.substr($str,$pos);
}else{
$str = $str;
}
return $str;
}
ins_str("99999999","-",3) // Shows 999-99999
ins_str("99999999"," ",-4)//Shows 9999 9999
can help in simple masks