• PHP Video Tutorials

PHP - Function similar text



Syntax

int similar_text ( string $first , string $second [, float &$percent ] )

Definition and Usage

It is used to calculate the similarity between two strings

Return Values

It returns the matching chars between both strings

Parameters

Sr.No Parameters & Description
1

first

It contains the information about the first string

2

Second

It contains the information about the second string

3

percent

By passing a reference as third argument, similar_text() will calculate the similarity in percent for you

Example

Try out the following example

<?php
   echo similar_text("Tutorials Point","Tutorials park");
?>

This will produce following result −

10
php_function_reference.htm
Advertisements