php - Function to list the unicode emoji -
i'm trying list unicode emoji php or js function, can't find way that. vim doesn't show unicode emoji , can't paste because break line changing characters , weird stuff.
i thought use unicode code (like u+1f600) , incrementation, can explain how this.
edit : til english, sorry bad english
edit 2 : made function hearth, if want use it, guest !
<?php // function used list of emojis (unicode) 👿 💀 // takes ranges of unicode decimal // find hexadecimal here : http://apps.timwhitlock.info/emoji/tables/unicode // convert in decimal here : http://www.binaryhexconverter.com/hex-to-decimal-converter // organised taste customisable // use larger ranges 128512 - 130000 see unicode browser compatibilty // // @mobidi 👻 function myemojis($emojiranges) { $_result = array(); foreach ($emojiranges $start => $end) { $current = $start; while ($current != $end) { $_result['emoji n°'.$current.''] = mb_convert_encoding(pack("n*", $current), "utf-8", "utf-32be"); $current ++; } } return $_result; } //key = start, value = end. $emojirangescustom = array( '128512' => '128590', '129296' => '129310', '129312' => '129319', '127744' => '128511', '128640' => '128705', '129296' => '129310', '129312' => '129319', '129360' => '129374', '129408' => '129425' ); $emojimerge = myemojis($emojirangescustom); ?> <div style="font-size:24px;text-align:justify"> <?php //while listing ! see next time 💨 foreach($emojimerge $keys => $emoji) { echo '<a href="#" title="'.$keys.'">'.$emoji.'</a> '; } ?> </div>
use table of emoj
in other versions of php should echo json_decode
echo json_decode('"\ud83d\ude00"'); 😀
but if use php 7
you no longer need use json_decode , can use \u , unicode literal:
echo "\u{1f30f}"; 🌏
or can use try other need download in github , include in project it's change class="names" , generate emoj
Comments
Post a Comment