Answers for "check if a word is contained in a string php"

PHP
93

php check if string contains word

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

How do I check if a string contains a specific word php

$a = 'How are you?';

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

how to check if a string contains a substring in php

$a = 'How are you?';

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

php find if substring is in string

$result = strpos("haystack", "needle");

if ($result != false)
{
  // text found
}
Posted by: Guest on March-13-2020
0

check exist string in string php

$myString = 'Hello Learn Tech Tips (Zidane)?';
if (strpos($myString, 'Zidane') !== false) {
    echo "This string contains Zidane";
}
Posted by: Guest on November-04-2021
0

if value conatins in word check in php

<?php
$word = "fox";
$mystring = "The quick brown fox jumps over the lazy dog";
 
// Test if string contains the word 
if(strpos($mystring, $word) !== false){
    echo "Word Found!";
} else{
    echo "Word Not Found!";
}
?>
Posted by: Guest on April-02-2021

Code answers related to "check if a word is contained in a string php"

Browse Popular Code Answers by Language