搜索文档
首页
HTML/CSS
JavaScript
服务端开发
Java教程
移动端
数据库
当前位置:
首页
服务端开发
PHP 教程
PHP 高级教程
源代码
清空
点击运行
<?php $pattern = '/\bcar\w*/'; $replacement = '<b>$0</b>'; $text = 'Words begining with car: cart, carrot, cartoon. Words ending with car: scar, oscar, supercar.'; echo preg_replace($pattern, $replacement, $text); ?>
运行结果