PHP code example of emleons / tz_namba

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

    

emleons / tz_namba example snippets

 
use Emleons\TzNamba\ValidateNamba;

$test = new ValidateNamba;
$phone = "+255752123456"; // Replace with the phone number you want to validate

if($test->validate($phone)){
    echo $phone." is a valid phone".'<br>';
}else{
    echo $phone." is an invalid phone".'<br>';
}
//sometimes you may want to remove prefix from phone numbers to do it use the remove_tz_prefix() method and pass your phone that follows accepted format
$removed_prefix = $test->remove_tz_prefix($phone);
echo "Removed prefix from ".$phone." to ".$removed_prefix;