PHP strncasecmp() Function with Examples

Program 1

<html>
    <head><title>String in PHP Application</title>
    <body>
  
  <pre>
    <center>
<?php
           $s1="flair";
           $s2="data"; 
           
           echo similar_text($s1,$s2);

        // $s1="data flair free course";
        // $s2="Data base system";
     
        //  //if(strncmp($s1,$s2,6)==0)
        //     if(strncasecmp($s1,$s2,4)==0)
        //  echo "<font color=green size=5>Same</font>";  
        // else
        // echo "<font color=red size=5>Not Same</font>";     
    //   $username="dATa flair";
    //   $password="indore";
    //   if(strcasecmp($username,"data flair")==0  && strcmp($password,"indore")==0)
    //             echo "<font color=green size=5>Valid user</font>";
    //    else
    //    echo "<font color=red size=5>Invalid user</font>";     
    //    $s1="Data Flair";
    //    $s2="daTA flair";
    //     if(strcasecmp($s1,$s2)==0)      
    //      echo "Same";
    //     else
    //     echo "Not same";
?>

</pre>
        </center>
</body>
</html>

 

courses

Leave a Reply

Your email address will not be published. Required fields are marked *