D
D
dmitred2021-09-10 06:23:21
PHP
dmitred, 2021-09-10 06:23:21

How to determine that there is an emoji in a string and take the first one into a variable?

I receive the message array and the $message->text variable from the telegram bot.

The final task is to check if the person sent me only one emoji.

Everything except, including the text and even the second emoji, is removed from the line.

The goal is to get only the first emoji from the array, or if there is none, then throw an error.

Tell me how to do this?

By the power of php?

I’ll add, I don’t know how to determine if there are emojis using php, github is hard, maybe someone has come across a little similar at least ....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2021-09-10
@dmitred

preg_match('/[^[:alnum:]]+/is', $text, $matches):
613ad8abf0c0f440144710.png
Sorry on phone, link not working

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question