Answers for "if string contains word in 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
8

php string contains string

$str = 'Hello World!';

if (strpos($str, 'World') !== false) {
    echo 'true';
}
Posted by: Guest on February-22-2022
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
40

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 March-27-2021
-1

check if string contains substring php 8

str_contains('STRING', 'SUB_STRING');
Posted by: Guest on December-06-2020

Code answers related to "if string contains word in php"

Browse Popular Code Answers by Language