How to make case-insensitive search with preg_match in PHP

1 Answer

0 votes
if (preg_match('/ph/', 'PHP Programming'))
	echo "Found<br>";
else
	echo "Not found<br>";

// add: i
if (preg_match('/ph/i', 'PHP Programming'))
	echo "Found<br>";
else
	echo "Not found<br>";




/*
run:

Not found
Found

*/

 



answered Aug 22, 2020 by avibootz

Related questions

...