check if word in string
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}if (strpos($string, 'substring') !== false) {
// do stuff
}$result = strpos("haystack", "needle");
if ($result != false)
{
// text found
}// returns true if $needle is a substring of $haystack
function contains($haystack, $needle){
return strpos($haystack, $needle) !== false;
}
Also in PHP:
- check string exist in php
- create seeds laravel
- composer install laravel
- clear cach php artisan
- create 64 digit random string php
- composer laravel project
- dates phpp
- find string into string
- ahow php errors
- array get only the value without duplicate
- #1146 - Table 'phplessons.super' doesn't exist
- alter row in table laravel
- date math sql php
- Call to a member function move() on string
- What parameter should you enable if you wish for your browser to show all errors?
- List all folder in pHP
- create laravel 6 project
- Laravel DB facade relations
- $val & 4 in php
- datephp
- date format in php function
- create random password in php
- browser cache laravel
- clear caches in laravel