₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,083 members, 8,420,223 topics. Date: Thursday, 04 June 2026 at 01:58 PM

Toggle theme

Php Function To Generate A Random Expression - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingPhp Function To Generate A Random Expression (1240 Views)

1 Reply

Php Function To Generate A Random Expression by chiwex(op): 10:11pm On Feb 02, 2018
If you are looking for a code function to generate a random expression, like password with alphanumeric or any other generate a random expression, use this function:

<?php
function GeraHash($qtd){
//Under the string $Caracteres you write all the characters you want to be used to randomly generate the code.
$Caracteres = 'ABCDEFGHIJKLMOPQRSTUVXWYZ0123456789';
$QuantidadeCaracteres = strlen($Caracteres);
$QuantidadeCaracteres--;

$Hash=NULL;
for($x=1;$x<=$qtd;$x++){
$Posicao = rand(0,$QuantidadeCaracteres);
$Hash .= substr($Caracteres,$Posicao,1);
}

return $Hash;
}

//Here you specify how many characters the returning string must have
echo GeraHash(30);
?>


source: http://php.net
1 Reply

Easy Way To Create A Random Password Generator In PythonJavascript Function To JavaUser Defined Function To Validate Regular Expression In Javascript234

Vacancy For A Software DeveloperI Am A Website Designer & Developer!!Please Who Can Help Me Submit My App To Google Play Store