note 45959 deleted from function.substr by aidan
| From: | aidan@php.net | Date: | Tue, 18 Jan 2005 15:41:09 +0000 |
| Subject: | note 45959 deleted from function.substr by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-83562@lists.php.net to get a copy of this message | ||
Note Submitter: devillo at supereva dot it
----
<?php
function insert_char($stringa,$needle,$insertbefore) {
$num=strlen($stringa);
for ($a=$num-2;$a>0;$a--) {
$temp=substr($stringa,$a);
if (strpos($temp,$needle)==1)
$stringa=substr($stringa,0,$a+1) . "$insertbefore" . substr($stringa,$a+1);
}
return $stringa;
}
$string="tanti' accenti' qui '";
echo insert_char($string,"'","\\");
?>
this function return "tanti\' accenti\' qui \'" .