I see that there's better support of Emojis in PHP 7 but no packaged set/library of emojis to reference from. As of now, I have to search and look for the UNICODE of the emoji I desire at https://apps.timwhitlock.info/emoji/tables/unicode.
Would there be an easier method to obtain every single (latest) Emoji by iterating through a loop rather than referencing an array I would have to build on my own (copying & pasting every UNICODE)?
Instead of listing all unicodes by hand, you can define the ranges and use a loop to iterate over them and print them.
This could look like this:
$emojiUnicodeRange = [
[0x1f600, 0x1f64e],
[0x1f910, 0x1f91e],
[0x1f920, 0x1f927],
[0x1f300, 0x1f5ff],
[0x1f680, 0x1f6c1],
[0x1f950, 0x1f95e],
[0x1f980, 0x1f991]
];
foreach($emojiUnicodeRange as $range)
    for($emojiUnicode=$range[0];$emojiUnicode<=$range[1];$emojiUnicode++)
        echo html_entity_decode('&#'.$emojiUnicode.';', 0, 'UTF-8');
The html_entity_decode('&#'.$emojiUnicode.';', 0, 'UTF-8') part converts the hex number to an entity and decode it as utf-8. Sadly there is no easier way to achieve this as far as I know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With