php之substr_count判断一个字符串是否包含另一个字符串

来源:互联网 发布:范思哲男装淘宝 编辑:程序博客网 时间:2024/05/21 14:45
 If you only want to look, if a string appears in another string - even at position 0 - , you can also use substr_count():
<?php  $mystring = "Hello Chris";  if (substr_count($mystring, "Hello") == 0)   echo "no";  // same as:  if (strpos($mystring, "Hello") === false)   echo "no";?>     


1 0
原创粉丝点击