check if string contains string php
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}$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 if key exist in php
- How can I install php7.4 on Ubuntu 18.04?
- file_get_contents php ssl
- check laravel version
- PHP script to get a list of folders from a path
- composer get php version
- Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0". when php is 7.4
- What is a Regular Expression in php
- Builder::unique() laravel
- Delete Query with Where Condition in Codeigniter
- create project laravel 6
- create new directory php
- ::create laravel
- clean url laravel CACHE
- clear browser cache in laravel
- count length of string php
- combox with auto filter, auto search cakephp
- Allowed memory size of 134217728 bytes exhausted (tried to allocate 157 bytes) in C:\wamp64\scripts\refresh.php on line 2263
- add day to date in php
- convert timestamp to date time in php
- create new laravel project 8
- clear cache in query codeigniter
- Fixes duplicate arrays to show a single character. php
- check same and differnt value in array in php