Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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';
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #I #check #string #specific
ADD COMMENT
Topic
Name
1+8 =