zl程序教程

您现在的位置是:首页 >  后端

当前栏目

【PHP】preg_match函数

PHP 函数 match preg
2023-09-27 14:25:58 时间

author 咔咔


wechat fangkangfk



preg_match函数是进行正则表达式的匹配 成功返回1 否则返回0



参数说明


屏幕快照 2022-05-13 下午10.54.11.png

public function index()

 if (preg_match( /php/i , PHP is the web scripting language of choice. , $matches))

 print A match was found: . $matches[0];

 else

 print A match was not found. 

 }

在这个正则里边有一个参数是i 这个在正则表达式里边是不区分大小写的一个参数


输出结果


image.png