php如何判断字符串是否含指定符号

2025年02月13日 建站教程

php哪些语法可以判断字符串是否含指定符号,下面web建站小编给大家简单介绍一下具体代码!

利用strripos()函数判断

<?php
header('content-type:text/html;charset=utf-8');   
$str = '3.24.15926';
$pos = strripos($str, ".");
 
var_dump($pos);
if($pos){
  echo $str." 包含字符圆点.<br>";
}else{
  echo $str." 不包含字符圆点.<br>";
}
?>

本文链接:http://so.lmcjl.com/news/23072/

展开阅读全文