Answers for "php check if string contains'"

PHP
6

php find if string contains

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

How do I check if a string contains a specific word?

$a = 'Hello world?';

if (strpos($a, 'Hello') !== false) { //PAY ATTENTION TO !==, not !=
    echo 'true';
}
if (stripos($a, 'HELLO') !== false) { //Case insensitive
    echo 'true';
}
Posted by: Guest on May-18-2020

Code answers related to "php check if string contains'"

Browse Popular Code Answers by Language