Horje
How do I check if a string contains a specific word php Code Example
php check if string contains word
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
    echo "My string contains Bob";
}
How do I check if a string contains a specific word php
$a = 'How are you?';

if (strpos($a, 'are') !== false) {
    echo 'true';
}
check if string contains character php
// this method is new with PHP 8 and above
$haystack = "Damn, I wonder if this string contains a comma.";
if (str_contains($haystack, ",")) {
	echo "There is a comma!!";
}
Source: www.php.net
php find if substring is in string
$result = strpos("haystack", "needle");

if ($result != false)
{
  // text found
}




Php

Related
carbon add minutes Code Example carbon add minutes Code Example
dump all variables twig Code Example dump all variables twig Code Example
orberby laravel Code Example orberby laravel Code Example
if word exist in string Code Example if word exist in string Code Example
php compare two dates Code Example php compare two dates Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7