Y
Y
Yuri2020-02-09 23:26:43
PHP
Yuri, 2020-02-09 23:26:43

Bot response to words in sentences?

How to make the bot react to specific words in sentences of any length? The bot is written in php. It would be nice if you send the code

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
HemulGM, 2020-02-10
@urec-borec

If it's simpler, then you can use the banal strpos , which will return you "not zero" if the string contains the substring you need.

$pos = strpos('бот реагировал на конкретные слова в предложениях', 'бот');
if ($pos === false) {
    echo "Подстрока не найдена";
} else {
    echo "Подстрока найдена";
}

X
xmoonlight, 2020-02-09
@xmoonlight

preg_match()

A
Alex, 2020-02-09
@Kozack

https://www.google.com/url?q=https://dialogflow.co...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question