Answers for "string search and matching string return php"

PHP
2

find in php string or

$a = 'How are you?';

if (strpos($a, 'are') !== false) {
    echo 'true';
}
Posted by: Guest on April-28-2020
0

php string search in array

// Search a partial string matching in array elements
function array_search_partial($arr, $keyword) {
    foreach($arr as $index => $string) {
        if (strpos($string, $keyword) !== FALSE)
            return $index;
    }
}
Posted by: Guest on October-24-2021

Browse Popular Code Answers by Language