1

I have a string:

$string = '‍♂️';

And i want to split in:

$array = ['1F602', '1F9DCU-200D-2642-FE0F'];

How can i do it?

I have already try to use some functions but they doesn’t works because they doesn’t split properly emojis with more then one unicode.

Thank you in advance!

Andreas
  • 23,610
  • 6
  • 30
  • 62
user2797134
  • 73
  • 1
  • 7
  • 1
    I am really not in this topic, and I can't identify the code of those symbols based on this: https://unicode.org/emoji/charts/full-emoji-list.html. But: I see three glyphs, but your array contains two elements. What is your logic behind this split? – ZorgoZ Sep 16 '18 at 15:42
  • @ZorgoZ if you try to select the second and the third emoji you can see that actualy they are one emoji symbol. – drkostas Sep 16 '18 at 15:50
  • My original message: https://imgur.com/gallery/EsGYI7y – user2797134 Sep 16 '18 at 15:52
  • Looking at the string using code from this answer https://stackoverflow.com/a/35050002/5159168 it does not seem to be two "items". https://3v4l.org/DBs9Q – Andreas Sep 16 '18 at 16:00

1 Answers1

1

I was about to write the code for splitting emojis using an emoji-unicode dictionary but fortunately the code already exists.

This repo contains everything you need.

You can either use it directly or explore the code and take what you want.

drkostas
  • 517
  • 1
  • 7
  • 29