PHP program to compare two strings with database and flowchart
PHP program to compare two strings with database and flowchart
In this tutorial, we will learn about the followings;
- Flowchart to compare two strings
- PHP program to compare two strings.
- PHP program to compare two strings with form values enter by user.
- PHP program to compare two strings with the database.
Flowchart to compare two strings
PHP program to compare two strings.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<!DOCTYPE html> <html> <body> <p>Click The Button to Compare The Strings.</p> <p>Hello!</p> <p>hello!</p> <p> 0 - if the two strings are equal<br> <0 - if string1 is less than string2<br> >0 - if string1 is greater than string2<br> </p> </body> </html> <?php $s1="Hello!"; $s2="hello!"; echo strcmp($s1,$s2); //https://www.w3schools.com/php/func_string_strcmp.asp ?> |
PHP program to compare two strings with form values enter by user.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<!DOCTYPE html> <html> <body> <p>Click The Button to Compare The Strings.</p> <form method="POST" name="form1"> Enter First String.<input type="text" value="" name="str1"/> Enter Second String.<input type="text" value="" name="str2"/> <input type="submit" name="sub" value="Compare"/> </form> <p> 0 -
if the two strings are equal<br> <0 - if string1 is less than string2<br> >0 - if string1 is greater than string2<br> </p> </body> </html> <?php if(isset($_POST["sub"])) { $s1=$_POST["str1"]; $s2=$_POST["str2"]; echo strcmp($s1,$s2); } //https://www.w3schools.com/php/func_string_strcmp.asp ?> |
PHP program to compare two strings with the database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<!DOCTYPE html> <html> <body> <p>Click The Button to Compare The Strings.</p> <p>Hello!</p> <p>hello!</p> <p> 0 - if the two strings are equal<br> <0 - if string1 is less than string2<br> >0 - if string1 is greater than string2<br> </p> </body> </html> <?php $s1="Hello!"; $s2="hello!"; echo strcmp($s1,$s2); //https://www.w3schools.com/php/func_string_strcmp.asp ?> |