【发布时间】:2011-02-22 03:40:12
【问题描述】:
我有一个基本的 PHP 字符串问题。
假设我有一个变量$story:
$story = 'this story is titled and it is really good';
如何在 'titled' 之后和 'and' 之前添加一个字符串? 如果我在另一个变量中有标题,那么说
$title = 'candy';
我可以使用什么函数或方法来做到这一点?
$story = 'this story is titled and it is really good';
$title = 'candy';
// do something
var_dump($story === 'this story is titled candy and it is really good'); // TRUE
【问题讨论】:
-
阅读手册中的字符串部分,这是基本的php php.net/manual/en/language.types.string.php