PHP code example of alecrabbit / php-wcwidth

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

    

alecrabbit / php-wcwidth example snippets


use function AlecRabbit\WcWidth\wcwidth;
use function AlecRabbit\WcWidth\wcswidth;

echo wcwidth('a'); // 1
echo wcwidth('é'); // 1
echo wcwidth('🐘'); // 2
echo wcswidth('🐘🐘🐘'); // 6

echo wcwidth('🐘🐘🐘'); // 2 - only first char is considered
bash
$ composer