check if a string contains something php
$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';
}preg_match('/(http|ftp|mailto)/', $string, $matches);
var_dump($matches);
Also in PHP:
- file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages 3
- ccreate array php
- check if part of string php
- NAME OF YOUR FORM in contact form 7
- add seeder laravel
- '"' error php
- database seeder insert laravel
- detail error in php code
- array_diff
- array_search in php
- check method in laravel
- REMOVE php error and warning
- add item to array in php
- array_key_exists contains string
- console log variable php
- The main error reporting flags include
- fgets function in php
- check if word belongs in string
- consol log put in php
- array unique values php
- check if array contain key php
- cache;clear laravel
- Custom Order By in CakePHP
- count column eloquent laravel