PHP code example of steppinghat / emoji-detector

1. Go to this page and download the library: Download steppinghat/emoji-detector library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

steppinghat / emoji-detector example snippets




teppingHat\EmojiDetector\EmojiDetector;

$input = "Hello 👋 world!";
$detector = new EmojiDetector();
$emojis = $detector->detect($input);

print_r($emojis);



teppingHat\EmojiDetector\EmojiDetector;

$input = "I ❤️ to 👨‍💻";
$detector = new EmojiDetector();
$emojis = $detector->detect($input);

print_r($emojis);



teppingHat\EmojiDetector\EmojiDetector;

$detector = new EmojiDetector();

$emojis = $detector->detectDistinct("WHAT IS A KILOMETER 🗣🗣🗣🦅🦅🦅")

print_r($emojis);



teppingHat\EmojiDetector\EmojiDetector;

$detector = new EmojiDetector();

$detector->isSingleEmoji("💩"); // Returns TRUE
$detector->isSingleEmoji("Time to dance 🌚"); // Returns FALSE
$detector->isSingleEmoji("🍆🍒"); // Returns FALSE



teppingHat\EmojiDetector\EmojiDetector;

$detector = new EmojiDetector();

$detector->isEmojiString("😂😂😂"); // Returns TRUE
$detector->isEmojiString("🏎️💨"); // Returns TRUE
$detector->isEmojiString("Deez nuts 🥜"); // Returns FALSE