check if a string contains 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';
}$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
Also in PHP:
- check if index of array exists php
- \r in php
- echo iterate array php
- cache clear in laravel
- DateTime() php
- SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max ke
- count of string in laravel
- check if key exists in php
- filegetcontent php ssl
- Allowed memory size of 56623104 bytes exhausted (tried to allocate 12288 bytes) wordpress
- download npm package
- convert json to array php
- Parse error: syntax error, unexpected '?' in /opt/lampp/htdocs/Tack.php on line 2
- create a new laravel 7 projects
- Syntax error or access violation: 1071 Specified key was t oo long; max key length is 1000 bytes
- delete a package laravel
- eslint clear cache
- PHP Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt()
- display custom post type
- current date function in php
- exec output php
- Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in windows local
- composer create-project laravel/laravel
- base64_decode online php