就像在C中一样,字符串是php中的数组
然后
<?php
$a = "hola";
for($i=0; $i < strlen($a); $i++) {
echo $a[$i] . "\n";
}
$a[2] = "-"; // will print ho-a
?>
Run Code Online (Sandbox Code Playgroud)
你想做什么手术?
explode ( string $delimiter , string $string [, int $limit ] )
Run Code Online (Sandbox Code Playgroud)
......并且在变化之后......
implode ( string $glue , array $pieces )
Run Code Online (Sandbox Code Playgroud)
看看http://php.net/explode
和http://php.net/implode
您也可以使用拆分或连接,据我所知,支持正则表达式