Home  >  Article  >  Backend Development  >  PHP怎么比较变量的大小

PHP怎么比较变量的大小

WBOY
WBOYOriginal
2016-06-13 11:58:301569browse

PHP如何比较变量的大小
php前段通过row获取到A字段的值
$A=$row['A'] ;
想要将$A和“无”这个字做比较,相等的话就显示“无”为红色。请问一下比较这里该怎么写呢。

------解决方案--------------------

$s = '想要将$A和“无”这个字做比较,相等的话就显示“无”为红色。请问一下比较这里该怎么写呢';<br />$A = '无';<br />echo preg_replace("/$A/", '<span style="color:#f00">$0</span>', $s);<br />

Statement:
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