Answers for "php if with like"

PHP
2

php if string contains

$a = 'How are you?';

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

php if string contains

if (str_contains('How are you', 'are')) { 
    echo 'true';
}
Posted by: Guest on March-07-2022
8

php string contains string

$str = 'Hello World!';

if (strpos($str, 'World') !== false) {
    echo 'true';
}
Posted by: Guest on February-22-2022

Browse Popular Code Answers by Language