T
T
TechNOIR2018-02-26 08:16:17
PHP
TechNOIR, 2018-02-26 08:16:17

How to make the simplest version of the recognition of the entered text?

Good afternoon. Tell me please. How to make the simplest version of the recognition of the entered text?
That is, the text is entered in the input field, for example the $q variable is in the php script. Suppose a person made a mistake and enters Pryuvet or Pka, and the script recognizes that it is Hello and Bye)
How can this be done with a database of predefined words using the simplest example?
thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Mashletov, 2018-02-26
@mashletov

str_replace(['прювет', 'пка', 'прив'], 'привет', $text);

or, better, preg_replace with \b

T
toxa82, 2018-02-26
@toxa82

levenshtein

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question