Php
Ask you a question:
PHP Custom Captcha function
function Random_text ($count, $rm _similar = False)
{
$chars = Array_flip (array_merge (range (0, 9), Range (' A ', ' Z '));
if ($rm _similar)
{
unset ($chars [0], $chars [1], $chars [2], $chars [5], $chars [8],
$chars [' B '], $chars [' I '], $chars [' O '], $chars [' Q '],
$chars [' S '], $chars [' U '], $chars [' V '], $chars [' Z ']);
}
for ($i = 0, $text = "; $i < $count; $i + +)
{
$text. = Array_rand ($chars);
}
return $text;
}
?>
What is the function of this code, $chars [5] What these mean: unset ($chars [0], $chars [1], $chars [2], $chars [5], $chars [8],
$chars [' B '], $chars [' I '], $chars [' O '], $chars [' Q '],
$chars [' S '], $chars [' U '], $chars [' V '], $chars [' Z ']);
This function is called, how to call, give an example.
Reply to discussion (solution)
If you run, you'll understand.
Unset releasing the given variable
This is a random text, not a verification code.
Example:
1. Take 7-bit text code, and remove the value in the unset random_text (7,true);//2. Take 5-bit text code, do not remove the value in unset, here the second argument by the function default is Falserandom_text (5);