<?php
function pass($level=2,$length=6) {
$chars[1] = "023456789abcdefghijmnopqrstuvwxyz";
$chars[2] = "23456789abcdefghijmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ";
$i = 0;
$str = "";
while ($i<=$length) {
$str .= $chars[$level][mt_rand(0,strlen($chars[$level]))];
$i++;
}
return $str;
}
echo pass(2, 7);
?>
When I call the function, I really can't set anything up. pass(2,7) is the same length as pass(1, 9). It's all level 2 and some length. What's wrong?
$charsis an array?