/**
 * Calculate the similarity between two strings.
 *
 * @param string $string The delimiting string.
 *
 * @return float Returns similarity percent.
 */
public function similarity(string $string): float

Examples

$result1 = Strings::create('hello')->similarity('hello');

$result2 = Strings::create('hello world')->similarity('hello');

echo $result1;

echo $result2;

The above example will output:

100

62.5

Getting Started

Methods