Answers for "regex string contains character php"

PHP
6

php find if string contains

if (strpos($string, 'substring') !== false) {
	// do stuff 
}
Posted by: Guest on August-25-2020
0

check if string contains character php

// this method is new with PHP 8 and above
$haystack = "Damn, I wonder if this string contains a comma.";
if (str_contains($haystack, ",")) {
	echo "There is a comma!!";
}
Posted by: Guest on May-27-2021

Code answers related to "regex string contains character php"

Browse Popular Code Answers by Language