PHP strncasecmp() Function with Examples
by TechVidvan Team
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>
Tags: PHPphp practicalphp programphp string comparison functionphp strncasecmp functionstring comparison function in phpstrncasecmp() function in php
TechVidvan Team
TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.