How to check if a string having specific characters or string In PHP we can check with strpos() . strpos() is the simplest way to get string having search texts or not. Examples :- For examle here is a php string and we want to know that it contains "php" word or not. $a = 'Hello string do u have php word?'; The below line of code echo true if php word exist in string. if (strpos($a, 'php') !== false) { echo 'true'; } OR if (strpos($string, $word) === FALSE) { ... not found ... } Answer 2 We can also use preg_match() to determine that Example if (preg_match('/php/',$a)) { echo 'true'; }
PHP,WORDPRESS,CAKEPHP,JQUERY,PHP TUTORIALS,CAKEPHP TUTORIALS,JQUERY CODES, CSS CODES, HTML CODES,EXPO, React, React Native, Angular,OOPS ,PHP INTERVIEW QUESTIONS @shubham715