check if string contains specific words
$a = 'Hello world?';
if (strpos($a, 'Hello') !== false) { //PAY ATTENTION TO !==, not !=
echo 'true';
}
if (stripos($a, 'HELLO') !== false) { //Case insensitive
echo 'true';
}
Also in PHP:
- 3 elements in do while loop php
- console.log php variable
- Activate errors tracking in your script using the ini_set() function
- add hour minute in datetime in php
- catch get error php
- find matching substrings in a string php
- Install or enable PHP's dom extension.
- error reporting php none
- * in array key php
- call controller function from another controller laravel
- add day to time php
- doctrine mongodb native query
- error reporting php all
- create random unique password with php
- catch php exception
- DateTime::diff()
- array only get duplicates
- d-m-Y php format with minutes
- check if word belongs in string
- creating new project laravel
- check if number is divided by 5 php
- file_put_contents php json file
- explain Y-m-d H:i:s.u
- create random password with refresh in php