Want to compare two strings using PHP, use the PHP
strcmp() function to compare two strings. Following is an example of compare two strings values using PHP:
$str1 = "Hello";
$str2 = "Hello World";
echo strcmp($str1, $str2);
//Expected output: -6
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.