Recursive validation of user input issues

Source: Internet
Author: User
function Checkenter ($canshu) {        //verify input $obj = new Base ($canshu), $re 1 = $obj->list_tables ($canshu);//if validation does not pass                if ($re 1 = = = False) {echo "The ' $canshu ' is not found, please input again \ n";//require input                        $canagin = enter again;//recursive Verification                        Ch Eckenter ($canagin);} return $canshu;}       $result = Checkenter ($canshu); Var_dump ($result);

Excuse me, if the first input succeeds, pass the verification, that return $canshu; no problem; But how do I get the value of the last input success in recursion? Thank you.


Reply to discussion (solution)

Not return Checkenter ($canagin); Do you?

Not return Checkenter ($canagin); Do you?
Thank you, that's it.
Checkenter ($canagin) is the $canshu in function Checkenter () when it enters recursion, is this understood?

Although the knot has been affixed, but the wrong approach must be corrected
Due to the non-reentrant nature of the HTTP protocol, the function Checkenter cannot appear recursively

Although the knot has been affixed, but the wrong approach must be corrected
Due to the non-reentrant nature of the HTTP protocol, the function Checkenter cannot appear recursively
Moderator adult, this example succeeded, this is a PHP_CLI program, thank you.

Although the knot has been affixed, but the wrong approach must be corrected
Due to the non-reentrant nature of the HTTP protocol, the function Checkenter cannot appear recursively

The little girl, there is a new problem: http://bbs.csdn.net/topics/390444529

  • 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.