class_mcString.inc.php
585 Bytes
<?php
/**
* @copyright (c) 2014, netz.coop eG
*/
class mcString {
public static function generateAlphaNumericRandumString($param_length=8) {
$characters = array(
"A","B","C","D","E","F","G","H","J","K","L","M",
"N","P","Q","R","S","T","U","V","W","X","Y","Z",
"1","2","3","4","5","6","7","8","9"
);
$keys = array();
while(count($keys) < $param_length) {
$x = mt_rand(0, count($characters)-1);
if(!in_array($x, $keys)) {
$keys[] = $x;
}
}
foreach($keys as $key){
$random_chars .= $characters[$key];
}
return $random_chars;
}
}
?>