PHP Classes

File: php/genRandomAlphabet.php

Recommend this page to a friend!
  Classes of bamigboye biodun   Logical Functions   php/genRandomAlphabet.php   Download  
File: php/genRandomAlphabet.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Logical Functions
General-purpose PHP and JavaScript functions
Author: By
Last change:
Date: 1 year ago
Size: 409 bytes
 

Contents

Class file image Download
<?php
function genRandomAlphabet(Int $length=1) : String {
$output = [];
for (
$i = 0; $i<$length;$i++)array_push($output,chr(rand(97,122)));
return
implode("",$output);
}
//-- Usage
print_r(genRandomAlphabet(4));
/*
Author : Biodun Bamigboye

Description
This function generates a random alphabet,
the length passed will be the length of the
return value e.g
genRandomAlphabet(5)
return value : "fhksi"

*/