Check if String Contains Substring using PHP

str_contains function

<?php

$text = 'Checking if a string contains a substring';
$result = str_contains($text, 'if');

echo $result ? 'Yes' : 'No';

Leave a Comment

Cancel reply

Your email address will not be published.