Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Code for creating random Safaricom Kenya Phone numbers (accompanying blog post:
// include Faker in your project (
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";

This comment has been minimized.

Copy link

@peter010 peter010 commented Apr 6, 2017

How do I create a phone number am confused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.