请问一个正则替换有关问题

WBOY
Release: 2016-06-13 11:54:38
Original
870 people have browsed it

请教一个正则替换问题
有这样的字符串 比如:

get_post_title

find_my_article


这样的字符串,如何用正则替换成:GetPostTitle,FindMyArticle ?

用explode,array_map(ucword),这样的法子用过了。现在想用正则实现,奈何功力不够啊


这个正则该如何写法?
------解决方案--------------------

$s = 'get_post_title';<br />echo preg_replace('/(^<br><font color='#FF8000'>------解决方案--------------------</font><br>_)(\w)/e', 'strtoupper("$2")', $s);<br />
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!