str_replace() 函数使用一个字符串替换字符串中的另一些字符。

注释:该函数对大小写敏感。请使用 str_ireplace() 执行对大小写不敏感的搜索。

echo str_replace("world","John","Hello world!");

 输出:

Hello John!

 

substr_replace() 函数把字符串的一部分替换为另一个字符串。

echo substr("Hello world!",6);

 输出:

world!

 

相关文章:

  • 2022-01-18
  • 2022-12-23
  • 2022-02-26
  • 2021-07-10
  • 2021-10-26
  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-06
  • 2021-10-31
  • 2021-08-28
  • 2021-11-09
  • 2021-10-08
  • 2022-12-23
  • 2023-04-10
相关资源
相似解决方案