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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # `slice` New in version 1.6: The `slice` filter was added in Twig 1.6. The `slice` filter extracts a slice of a sequence, a mapping, or a string: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7</pre></div></td><td class="code"><div class="highlight"><pre>{% for i in [1, 2, 3, 4, 5]|slice(1, 2) %} {# will iterate over 2 and 3 #} {% endfor %} {{ '12345'|slice(1, 2) }} {# outputs 23 #} </pre></div></td></tr></table> You can use any valid expression for both the start and the length: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3</pre></div></td><td class="code"><div class="highlight"><pre>{% for i in [1, 2, 3, 4, 5]|slice(start, length) %} {# ... #} {% endfor %} </pre></div></td></tr></table> As syntactic sugar, you can also use the `[]` notation: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11</pre></div></td><td class="code"><div class="highlight"><pre>{% for i in [1, 2, 3, 4, 5][start:length] %} {# ... #} {% endfor %} {{ '12345'[1:2] }} {# will display "23" #} {# you can omit the first argument -- which is the same as 0 #} {{ '12345'[:2] }} {# will display "12" #} {# you can omit the last argument -- which will select everything till the end #} {{ '12345'[2:] }} {# will display "345" #} </pre></div></td></tr></table> The `slice` filter works as the [array_slice](http://php.net/array_slice) [http://php.net/array_slice] PHP function for arrays and[mb_substr](http://php.net/mb-substr) [http://php.net/mb-substr] for strings with a fallback to [substr](http://php.net/substr) [http://php.net/substr]. If the start is non-negative, the sequence will start at that start in thevariable. If start is negative, the sequence will start that far from the endof the variable. If length is given and is positive, then the sequence will have up to thatmany elements in it. If the variable is shorter than the length, then only theavailable variable elements will be present. If length is given and isnegative then the sequence will stop that many elements from the end of thevariable. If it is omitted, then the sequence will have everything from offsetup until the end of the variable. Note It also works with objects implementing the [Traversable](http://php.net/manual/en/class.traversable.php) [http://php.net/manual/en/class.traversable.php] interface. ### Arguments - `start`: The start of the slice - `length`: The size of the slice - `preserve_keys`: Whether to preserve key or not (when the input is an array)
                  <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>

                              哎呀哎呀视频在线观看