Last active
October 8, 2020 16:41
-
-
Save muya/d44dd3d379bcdef175cf to your computer and use it in GitHub Desktop.
Code for creating random Safaricom Kenya Phone numbers (accompanying blog post: https://blog.muya.co.ke/random-safaricom-kenya-phone-numbers/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// include Faker in your project (https://github.com/fzaninotto/Faker#installation) | |
use Faker\Factory as Faker; | |
$faker = Faker::create(); | |
$regex = "/(\+?254|0){1}[7]{1}([0-2]{1}[0-9]{1}|[9]{1}[0-2]{1})[0-9]{6}/"; | |
$samplePhoneNumber = $faker->regexify($regex); | |
echo $samplePhoneNumber . "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do I create a phone number am confused