Answers for "check if char present in string php"

PHP
5

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
3

if text contains word then in php

if (strpos($haystack,$needle) !== false) {
    echo "$haystack contains $needle";
}
Posted by: Guest on July-16-2020

Code answers related to "check if char present in string php"

Browse Popular Code Answers by Language