check if word in string php
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}if (strpos($string, 'substring') !== false) {
// do stuff
}$a = 'Hello world?';
if (strpos($a, 'Hello') !== false) { //PAY ATTENTION TO !==, not !=
echo 'true';
}
if (stripos($a, 'HELLO') !== false) { //Case insensitive
echo 'true';
}$result = strpos("haystack", "needle");
if ($result != false)
{
// text found
}
Also in PHP:
- clear cache without using composer in laravel 8
- $result->result()
- array_push php
- datetime format laravel
- If is home page
- <Directory /usr/share/phpMyAdmin/> Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 </Directory>
- check if page is index wordpress
- array_unique() on value php
- create laravel app using composer
- check if key of array key true or false foreach php
- debugger in laravel
- date format Ymd php
- 500 server error in laravel
- Illuminate\Contracts\Container\BindingResolutionException Target class [HomeController] does not exist.
- PHP-specific format
- check if a key has a value array php
- filename php
- currentdate in unix php
- check gettype is string php
- clear cache config laravel
- 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))
- check datatype in php
- console log php
- contains in php string