PHPif. elseif. else

Source: Internet
Author: User
PHPif .. elseif... else question this post was last edited by xytianshiwx from 2013-12-0810: 09: 44 & nbsp; & lt ;? Php & nbsp; $ field_func = "COUNT | AVG | FIRST | last php if... elseif... else
This post was last edited by xytianshiwx at 10:09:44, January 8 ,.

$ Field_func = "COUNT | AVG | FIRST | LAST | MAX | MIN | SUM | TOP ";
$ Where_field = "Where | or | xor | and | in ";
$ Param = "name ";
$ SQL _param_list = array ();
If (false! = Strpos ($ param, ",") {// determines whether "," exists.
$ SQL _param_list ["field"] = $ param;
} Else {
If (preg_match ("/\ B (". strtolower ($ field_func ). ") \ B \ (\ * | [a-zA-Z _ ']) + \)/I", $ param )){
$ SQL _param_list ["field"] = $ param;
} Elseif (preg_match ("/\ B (". $ where_field. ") \ B/I", $ param) | preg_match ("/(>|>|=)/I", $ param) {// judge where
$ SQL _param_list ["where"] = $ param;

} Elseif (preg_match ("/\ B (order | limit | group |) \ B/I", $ param, $ param_name) {// judge order | limit | group
Switch ($ param_name [0]) {
Case "order": $ SQL _param_list ["order"] = $ param;
Break;
Case "limit": $ SQL _param_list ["limit"] = $ param;
Break;
Case "group": $ SQL _param_list ["group"] = $ param;
Break;

}
} Else {
$ SQL _param_list ["field"] = $ param;
}
}
Print_r ($ SQL _param_list );



$ Param is not assigned $ SQL _param_list ["field"]?
Logic errors or other errors !!! Share: More

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.