PHP code to insert a string at a specified position in the string_PHP tutorial

WBOY
Release: 2016-07-21 15:40:57
Original
787 people have browsed it

Copy code The code is as follows:

//Insert a string
function str_insert($str, $i, $substr)
{
for($j=0; $j<$i; $j++){
$startstr .= $str[$j];
}
for ($j= $i; $j$laststr .= $str[$j];
}
$str = ($startstr . $substr . $laststr) ;
return $str;
}

Popularity: 3%

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321264.htmlTechArticleCopy the code The code is as follows: //Insert a string function str_insert($str, $i, $substr) { for($j=0; $j$i; $j++){ $startstr .= $str[$j]; } for ($j=$i; $jstrlen($str); $j++){ $last. ..
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template