Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Check if a String Starts With a Specified String in PHP

phpCopy<?php
  $string = "Mr. Peter";
  if(substr($string, 0, 3) === "Mr."){
      echo "The string starts with the desired substring.";
  }else 
      echo "The string does not start with the desired substring.";
?>
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #Check #String #Starts #With #Specified #String #PHP
ADD COMMENT
Topic
Name
5+1 =