<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                # 流程控制 * * * * * > 任何 PHP 腳本都是由一系列語句構成的。一條語句可以是一個賦值語句,一個函數調用,一個循環,一個條件語句或者甚至是一個什么也不做的語句(空語句)。語句通常以分號結束。此外,還可以用花括號將一組語句封裝成一個語句組。語句組本身可以當作是一行語句。本章介紹了各種語句類型。 Table of Contents if else elseif/else if 流程控制的替代語法 while do-while for foreach break continue switch declare return require include require_once include_once goto * * * * * **if** ~~~ <?php if ( $a > $b ) echo "a is bigger than b" ; ?> ~~~ **else** ~~~ if ( $a > $b ) { echo "a is greater than b" ; } else { echo "a is NOT greater than b" ; } ~~~ **elseif/else if** ~~~ if ( $a > $b ) { echo "a is bigger than b" ; } elseif ( $a == $b ) { echo "a is equal to b" ; } else { echo "a is smaller than b" ; } ~~~ **流程控制的替代語法** ~~~ <?php if ( $a == 5 ): ?> A is equal to 5 <?php endif; ?> ~~~ **while** ~~~ $i = 1 ; while ( $i <= 10 ) { echo $i ++; /* the printed value would be $i before the increment (post-increment) */ } ~~~ **do-while** ~~~ $i = 0 ; do { echo $i ; } while ( $i > 0 ); ~~~ **for** ~~~ for ( $i = 1 ; $i <= 10 ; $i ++) { echo $i ; } ~~~ **foreach** ~~~ foreach (array( 1 , 2 , 3 , 4 ) as & $value ) { $value = $value * 2 ; } ~~~ **break** ~~~ switch ( $i ) { case '1': // Works echo "$i=1"; break; case '2': // Works require( 'include1.inc' ); break; case '3': // Doesn't work require( 'include2.inc' ); break; case '4': // Doesn't work, same reason require( 'include2.inc' ); default: // Works echo "$i"; } ~~~ **continue** ~~~ for ( $i = 0 ; $i < 5 ; ++ $i ) { if ( $i == 2 ) continue print " $i \n" ; } ~~~ **switch** ~~~ switch ( $i ) { case "apple" : echo "i is apple" ; break; case "bar" : echo "i is bar" ; break; case "cake" : echo "i is cake" ; break; } ~~~ **declare** ~~~ // these are the same: // you can use this: declare( ticks = 1 ) { // entire script here } // or you can use this: declare( ticks = 1 ); // entire script here ~~~ **return** 如果在一個函數中調用 return 語句,將立即結束此函數的執行并將它的參數作為函數的值返回。 **require** **include** ~~~ vars.php <?php $color = 'green' ; $fruit = 'apple' ; ?> test.php <?php echo "A $color $fruit " ; // A include 'vars.php' ; echo "A $color $fruit " ; // A green apple ?> ~~~ **require_once** **include_once** ~~~ include_once "a.php" ; // 這將包含 a.php include_once "A.php" ; // 這將再次包含 a.php!(僅 PHP 4) ~~~ **goto** ~~~ goto a ; echo 'Foo' ; a : echo 'Bar' ; ~~~ > goto 操作符僅在 PHP 5.3及以上版本有效。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看