check if string contains a character 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';
}
Also in PHP:
- echo message or display default message php
- custom time php function
- days to date php
- clave generator php
- check_string_lenght in php
- check if array is duplicate and get the latest values php
- convert uppercase to capitalize in php
- check php version
- Allowed memory size of 1610612736 bytes exhausted (tried to allocate 40 bytes) in phar:///opt/cpanel/composer/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 129
- echo in json format php
- Get the full url of the page in php
- disable timestamp laravel
- array_key_exists contains string
- Add the file php
- cache laravel example
- clear catche laravel
- curent date and time php
- display errors on
- catch an exception within a catch block php
- To find out where your php.ini is located
- clear array php
- delete cache on host laravel
- current datetime php
- date to string php