PHP code example of kennynguyeenx / vietnamese-text

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

    

kennynguyeenx / vietnamese-text example snippets


use Kennynguyeenx\VietnameseText\VietnameseText;

$vietnameseText = new VietnameseText();
echo $vietnameseText->filter(' áo  ' . PHP_EOL . 'dài '); // áo dài

use Kennynguyeenx\VietnameseText\VietnameseText;

$vietnameseText = new VietnameseText();
echo $vietnameseText->strToLowerCase('XIN CHÀO CÁC BẠN'); // xin chào các bạn

use Kennynguyeenx\VietnameseText\VietnameseText;

$vietnameseText = new VietnameseText();
echo $vietnameseText->strToUpperCase('Xin Chào Các Bạn'); // XIN CHÀO CÁC BẠN

use Kennynguyeenx\VietnameseText\VietnameseText;

$vietnameseText = new VietnameseText();
echo $vietnameseText->strLen('Xin Chào Các Bạn'); // 16

use Kennynguyeenx\VietnameseText\VietnameseText;

$vietnameseText = new VietnameseText();
echo $vietnameseText->strRev('Xin Chào'); // oàhC niX

use Kennynguyeenx\VietnameseText\VietnameseText;

$vietnameseText = new VietnameseText();
var_dump($vietnameseText->strSplit('xin chào')); 
/* 
array(8) {
    [0]=>
    string(1) "x"
    [1]=>
    string(1) "i"
    [2]=>
    string(1) "n"
    [3]=>
    string(1) " "
    [4]=>
    string(1) "c"
    [5]=>
    string(1) "h"
    [6]=>
    string(2) "à"
    [7]=>
    string(1) "o"
}
*/

use Kennynguyeenx\VietnameseText\VietnameseText;

$vietnameseText = new VietnameseText();
echo $vietnameseText->upperCaseFirst('đại biểu'); // Đại biểu

use Kennynguyeenx\VietnameseText\VietnameseText;

$vietnameseText = new VietnameseText();
echo $vietnameseText->convertToLatin('đại biểu'); // dai bieu