check if word include string
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}$a = 'Hello world?';
if (strpos($a, 'Hello') !== false) { //PAY ATTENTION TO !==, not !=
echo 'true';
}
if (stripos($a, 'HELLO') !== false) { //Case insensitive
echo 'true';
}if (strpos($a, 'are') !== false) {
echo 'true';
}
Also in PHP:
- count charcter in php
- /phpspreadsheet 1.15.0 requires ext-dom * centos yum
- datetime get month php
- eloquent firstOrCreate
- 20210329 to date format php
- check key value exist in array php
- find a specific word in a string php
- encryption and decryption in php example
- extract contact page url php
- do_shortcode not working
- Arr::get laravel
- Composer detected issues in your platform
- extend multiple classes in php
- echo errors of php
- change timestamp to date php
- codeigniter redirect
- create random username with numbers and letters php
- add redirect page php
- acf gutenberg blocks
- clear config cache laravel
- check where key in associative array have a value
- ddev laravel setup
- delete cache manually laravel 5
- composer set php version