<?php 
class generatepassword
{
	function create($num){ 
	//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<=$num;$x++){ 
	        $Posicao = rand(0,$QuantidadeCaracteres); 
	        $Hash .= substr($Caracteres,$Posicao,1); 
	    } 
	    //Here you specify how many characters the returning string must have
	return $Hash; 
	} 
}
 
 
?>