PHP

PHP Menu

PHP

levenshtein() Function - Definition, Syntax, Parameters, Examples

Definition

The levenshtein() function returns the Levenshtein distance(the number of characters you have to replace, insert or delete to transform string1 into string2) between two strings.

Syntax

levenshtein(string1, string2, insert, replace, delete)

Parameters

Parameter Description
string1 Numeric or String. Specifies the key.
string2 Specifies the value on the given key.
insert Specifies the value on the given key.
replace Specifies the value on the given key.
delete Specifies the value on the given key.

Example

<?php
echo levenshtein("Hello World","ello World"); echo "<br>"; echo levenshtein("Hello World","ello World", 10, 20, 30);

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods