PHP code example of talkroute / message-segment-calculator

1. Go to this page and download the library: Download talkroute/message-segment-calculator 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/ */

    

talkroute / message-segment-calculator example snippets


use Talkroute\MessageSegmentCalculator\SegmentCalculator;

$message = '💡 With great power comes great responsibility.';
$segmentsUsedCount = SegmentCalculator::segmentsCount($message);

echo "The '$message' message used $segmentsUsedCount segments."

SegmentCalculator::bitsCount($message);

SegmentCalculator::segmentsCount($message, true);
SegmentCalculator::bitsCount($message, true);