Answers for "how to check string like in php"

PHP
65

php string contains substring

$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
    echo "My string contains Bob";
}
Posted by: Guest on August-06-2019
0

like %% inside the string php

strpos('STRING', 'SEARCH_ITEM');

--------------OR--------------------
  
preg_match('~' . preg_quote('.SEARCH_ITEM.', '~') . '~', 'STRING');
Posted by: Guest on September-27-2020

Code answers related to "how to check string like in php"

Browse Popular Code Answers by Language