PHP compares two string lengths of methods, PHP two string lengths
The example in this article describes how PHP compares two string lengths. Share to everyone for your reference. The implementation method is as follows:
This code calculates the length of the two string and calculates its difference
<?php//This would return a number of how many more characters the longest string have function str_compare_length ($str 1 , $str 2) { $len 1 = strlen ($str 1); $len 2 = strlen ($str 2); Return ABS ($len 1-$len 2); } Echo Str_compare_length ("This was the first string", "This is the second string");?>
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1031483.html www.bkjia.com true http://www.bkjia.com/PHPjc/1031483.html techarticle PHP compares two string lengths, PHP two string lengths This example describes how PHP compares two string lengths. Share to everyone for your reference. Concrete implementation methods such as ...