Created
September 7, 2019 18:08
-
-
Save farshidrezaei/1ca73e65b4182f0f25bdf4f0387c41ad to your computer and use it in GitHub Desktop.
Replace Fakers
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 | |
//Faker offers a couple of methods that let you replace placeholders in a given string with random characters: | |
//lexify - takes given string and replaces ? with random letters | |
//asciify - takes given string and replaces * with random ascii characters | |
//numerify - takes given string and replaces # with random digits | |
//bothify - combines the lexify and numerify | |
//You could try to use one of them, depending on the requirements you have for that random string you need. asciify uses the largest set of characters as replacement so using that one makes most sense. | |
//The following will give you a random string of 20 ascii characters: | |
$faker->asciify('********************'); // will give you a random string of 20 ascii characters | |
$faker->lexify('##########'); // will give you a random string of 10 digits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment