Introduction
In this article I describe the PHP string functions levenshtein, localeconv and ltrim. To learn some other math functions, go to:
- String Functions in PHP: Part1
- String Functions in PHP:Part2
- String Functions in PHP:Part3
- String Functions in PHP:Part4
- String Functions in PHP:Part5
- String Functions in PHP:Part6
- String Functions in PHP:Part7
PHP levenshtein() Function
The PHP string levenshtein function calculates the levenshtein string between two strings.
Syntax
| levenshtein(string1, string1, insert, replace, delete) |
Parameter in levenshtein function
The parameters of the levenshtein function are:
| Parameter | Description |
| string1 | It specifies the first string to compare. |
| string2 | It specifies the second string to compare. |
| insert | It defines the cost of insertion. |
| replace | It defines the cost of replacement. |
| delete | It specifies the cost of deletion. |
Example
An example of the levenshtein function is:
<?php
echo levenshtein("MCN Solution","CN Soluti")."</br>";
echo levenshtein("MCN Solution","CN Soluti",5,10,15);
?>
Output
PHP localeconv() Function
The PHP string localeconv function gets the numeric formatting information and returns an associative array containing localized numeric and monetary formatting information.
Syntax
| localeconv() |
Example
An example of the localeconv function is:




Join the conversation! Your thoughts help the community grow.