Problems with PHP custom CAPTCHA functions

Source: Internet
Author: User
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);
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.