Home > Backend Development > PHP Tutorial > PHP基础知识点汇总(二)

PHP基础知识点汇总(二)

WBOY
Release: 2016-06-23 13:17:09
Original
963 people have browsed it

二、PHP流程控制结构

  分支结构:

    单一条件分支结构   双向条件分支结构   多向条件分支结构   巢状条件分支结构
      if(表达式){      if(表达式){      if(表达式){        if(表达式){
        ...            ...          ...            if(表达式){
      }           }else{        elseif(表达式){         ...

                   ...           ...           }

                 }          }             elseif(表达式){

                        ----------------       if(表达式){

                        switch(表达式){          ...
                                        }else{ 
                        case 值1:             ...

                          ...             }

                          break;        }

                        case 值2:
                          ...
                          break;
                        case 值3:
                          ...
                          break;
                        default:
                          ...
                        }





  循环结构:

      while语句:        do...while语句:        for语句:
      while(表达式){      do{               for(初始化;条件表达式;增量){
        ...           ...              ...
      }            }while(表达式);      }

  特殊流程控制语句:

    break:中断当前循环,即结束循环的执行
    continue:只能使用在循环内部,功能是跳过该次循环,执行下一次循环
    exit:不论在哪个结构中,直接退出当前脚本

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template