Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Emojis to Words
- 1. json encode an emoji to get its surrogate pair
- ```
- $surrogate_pair = json_encode(🌊);
- print $surrogate_pair; //"\ud83c\udf0a"
- ```
- 2. The surrogate pair is the key in the array, check if the key exists and send back the associated keyword. The `$emojis_to_words` variable is an array you need to include in your project.
- ```
- if(array_key_exists($surrogate_pair, $emojis_to_words)) {
- $keyword = $emojis[$surrogate_pair];
- print $keyword;
- }
- ```
- 3. In this example `print $keyword` will show you "waves".
Add Comment
Please, Sign In to add comment