function stripscript(s) { returns.replace(/<script.*?>.*?<\/script>/ig, ''); }
/ 之间的内容 / 是 regex 正则语句的书写开始与结束
.*? 是贪婪的匹配 .* 是匹配任何字符,但用贪婪的就是不包含 > 的内容
/ig 是不区分大小写和全局替换
学习日志 LIUGUOFENG
function stripscript(s) { returns.replace(/<script.*?>.*?<\/script>/ig, ''); }
/ 之间的内容 / 是 regex 正则语句的书写开始与结束
<?php $people = array("Peter", "Joe", "Glenn", "Cleveland"); if(in_array("Glenn", $people)) { echo"Match found"; }else{ echo"Match not found"; } ?>
输出:
Match found
<?php $a = array("a"=>"Dog", "b"=>"Cat"); if(array_key_exists("a", $a)) { echo"Key exists!"; }else{ echo"Key does not exist!"; } ?>
输出:
Key exists!
<?php $a = array("a" => "Dog", "b" => "Cat", "c" => 5, "d" => "5"); echo array_search("Dog", $a); echo array_search("5", $a); ?>
输出:
ac