Skip to content

Kirby 5.0.4

Str::similarity()

Calculates the similarity between two strings with multibyte support

Str::similarity(string $first, string $second, bool $caseInsensitive = false): array

Parameters

Name Type Default Description
$firstrequired string no default value
$secondrequired string no default value
$caseInsensitive bool false If true, strings are compared case-insensitively

Return type

array

matches: Number of matching chars in both strings percent: Similarity in percent

Parent class

Kirby\Toolkit\Str