PHP code example of maximal / emoji

1. Go to this page and download the library: Download maximal/emoji 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/ */

    

maximal / emoji example snippets




use Maximal\Emoji\Detector;

// Whether the given string contains emoji characters
$isEmojiFound = Detector::containsEmoji($string);
// 'test' -> false
// 'test 👍' -> true

// Whether the given string consists of emoji characters only
$isEmojiOnly = Detector::onlyEmoji($string);
// 'test 👍' -> false
// '👍😘' -> true

// String without any emoji character
$stringWithoutEmoji = Detector::removeEmoji($string);
// 'test 👍' -> 'test '
// '👍😘' -> ''

// All emojis of the string
$allEmojis = Detector::allEmojis($string);
// 'test 👍' -> ['👍']
// '👍😘' -> ['👍', '😘']

// Starting emojis of the string
$startingEmojis = Detector::startingEmojis($string);
// '👍😘 test' -> ['👍', '😘']
// 'test 👍' -> []
sh
php test/tests.php