PHP code example of mnavarrocarter / chilean-rut

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

    

mnavarrocarter / chilean-rut example snippets




use MNC\Rut;

$rut = Rut::parse('23.546.565-4');



use MNC\Rut;

$rut = Rut::parse('23.546.565-4');

$rut->number; // (int) 23546565
$rut->verifier; // (MNC\Rut\Verifier::Four) 4



use MNC\Rut;

$rut = Rut::parse('23.546.565-4');

echo $rut->toString();          // 235465654
echo $rut->toSimple();          // 23546565-4
echo $rut->toHuman();           // 23.546.565-4
echo $rut->last(4);             // 6565
echo $rut->last(4, pad: '*');   // ****6565
echo $rut->first(4);            // 2354
echo $rut->first(4, pad: '*');  // 2354****