check if substr in string php
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}$a = 'How are you?';
if (strpos($a, 'are') !== false) {
echo 'true';
}$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:
- data type checking php
- 5 sec delay timer in php
- am pm time format in php
- Extra header element 'From' cannot be other than string or array. in
- check string exist in string php
- Authorization header (API Key) is missing" }in guzzle
- Increase execution time of server
- Object of class Illuminate\\Database\\Eloquent\\Builder could not be converted to string
- check if in array php key
- compress video file size php
- connect to ftp server php
- fetch data from live website curl php
- Error: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.
- afficher type et contenu d'une variable php
- convert space to 20 php
- ajax project using php and jquery
- array key exi
- blood groups laravel seeder
- combine two query value in laravel 8
- check if array contains key php
- filter in route:list
- array unique php index not getting organised
- element has key in an array
- find a file in php