为何不能对正则匹配的值进行大写转换呢

WBOY
Release: 2016-06-13 11:13:10
Original
1184 people have browsed it

为什么不能对正则匹配的值进行大写转换呢?

	function syntax_color_sql($string)<br />	{<br />		$pattern='#select|left join|having|union|from|right join|limit|where|order by|for lock#sUi';<br />		return preg_replace($pattern, '<font color="#ffcc00">'.strtoupper('$0').'</font>', $string);<br />	}
Copy after login


------解决方案--------------------
本帖最后由 xuzuning 于 2013-01-25 12:38:54 编辑     $pattern='#select
------解决方案--------------------
left join
------解决方案--------------------
having
------解决方案--------------------
union
------解决方案--------------------
from
------解决方案--------------------
right join
------解决方案--------------------
limit
------解决方案--------------------
where
------解决方案--------------------
order by
------解决方案--------------------
for lock#sUie';
    return preg_replace($pattern, '"".strtoupper("$0").""', $string);
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