Skip to content

znittzel/php_name_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PhpNameGenerator

A small random name generator. Generates names based on givin minimum and maximum lenghts. These are not "real" names, just randomly selected characters creating a word. Perfect when creating a name for an application.

<?php
    //################ Example of usage ###############//
    
    // Include the php file
    include 'NameGenerator.php';

    // Init generator
    $generator = new NameGenerator();

    // Get givin number of random names
    $names = $generator->generateNames(100);

    // Iterate through the array of names
    foreach ($names as $name)
        echo $name->getString().'<br/>';
?>

Change minimum and maximum lenghts

<?php
    // OPTION 1
    // When initializing generator object
    $generator = new NameGenerator(1, 100); // Will create random names which's between 1 and 100 chars

    // OPTION 2
    // When generator already's been initialized
    $generator->setLenght(1, 100);
?>

About

A simple random name generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages