Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Check if a String Contains a Substring in PHP

phpCopy<?php
$mystring = "This is a php program.";
$search = "a";
if(preg_match("/{$search}/i", $mystring)) {
    echo "True"; } else {
    echo("False");
}
?>
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #Check #String #Contains #Substring #PHP
ADD COMMENT
Topic
Name
5+7 =