2013-05-19 60 views
-3
$string=apple 
$add=£ 
$new=app£le 

我面臨在字符串中插入字符的問題。如何在字符串中插入字符

+0

進一步幫助更多的想法:如何插入另一個字符串中的字符串(http://stackoverflow.com/questions/1372737/how-to-insert-a-string-inside-another-string ) –

回答

2
$string='apple'; 
$add='£'; 
$new=substr_replace($string,$add,3,0); 
echo $new; 
2

如果我是你,我會串分成兩個在想要的位置,然後拼接回來一起用新的角色在增加。

我會給更多的細節,但我不知道你想要的分裂規則是什麼。

+0

我需要插入字符串然後3.字符例如:melon> mel£on,banana> ban£ana,orange> ora£nge –