check subtring php code example
Example 1: how to check if a string contains a substring in php
$a = 'How are you?';
if (strpos($a, 'are') !== false) {
echo 'true';
}
Example 2: check if string contains substring php 8
str_contains('STRING', 'SUB_STRING');