【发布时间】:2014-05-22 18:11:27
【问题描述】:
您好,我需要将字符串的最后一个字母包装在 span 标签中,我该如何在 php 中做到这一点?
例如:
$string = 'Get on the roller coaster';
应该输出:
'Get on the roller coaste<span>r</span>'
【问题讨论】:
-
O_o 为什么需要这样做?
-
我想给最后一个字母上色,但不能控制 html,因为它是由 wordpress 动态创建的
标签: php regex str-replace