<small id='mIAsm'></small><noframes id='mIAsm'>

<legend id='mIAsm'><style id='mIAsm'><dir id='mIAsm'><q id='mIAsm'></q></dir></style></legend>

  1. <tfoot id='mIAsm'></tfoot>
  2. <i id='mIAsm'><tr id='mIAsm'><dt id='mIAsm'><q id='mIAsm'><span id='mIAsm'><b id='mIAsm'><form id='mIAsm'><ins id='mIAsm'></ins><ul id='mIAsm'></ul><sub id='mIAsm'></sub></form><legend id='mIAsm'></legend><bdo id='mIAsm'><pre id='mIAsm'><center id='mIAsm'></center></pre></bdo></b><th id='mIAsm'></th></span></q></dt></tr></i><div id='mIAsm'><tfoot id='mIAsm'></tfoot><dl id='mIAsm'><fieldset id='mIAsm'></fieldset></dl></div>

      <bdo id='mIAsm'></bdo><ul id='mIAsm'></ul>

      str_split 没有自动换行

      时间:2023-10-03

      <small id='i0NqK'></small><noframes id='i0NqK'>

      <i id='i0NqK'><tr id='i0NqK'><dt id='i0NqK'><q id='i0NqK'><span id='i0NqK'><b id='i0NqK'><form id='i0NqK'><ins id='i0NqK'></ins><ul id='i0NqK'></ul><sub id='i0NqK'></sub></form><legend id='i0NqK'></legend><bdo id='i0NqK'><pre id='i0NqK'><center id='i0NqK'></center></pre></bdo></b><th id='i0NqK'></th></span></q></dt></tr></i><div id='i0NqK'><tfoot id='i0NqK'></tfoot><dl id='i0NqK'><fieldset id='i0NqK'></fieldset></dl></div>

                <tbody id='i0NqK'></tbody>
                <bdo id='i0NqK'></bdo><ul id='i0NqK'></ul>
                <legend id='i0NqK'><style id='i0NqK'><dir id='i0NqK'><q id='i0NqK'></q></dir></style></legend>

                <tfoot id='i0NqK'></tfoot>
                本文介绍了str_split 没有自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在寻找最快的解决方案,以拆分 一个字符串分成几部分,没有 自动换行.

                I'm looking for the fastest solution, to split a string into parts, without word-wrap.

                $strText = "The quick brown fox jumps over the lazy dog";
                
                $arrSplit = str_split($strText, 12);
                
                // result: array("The quick br","own fox jump","s over the l","azy dog");
                // better: array("The quick","brown fox","jumps over the","lazy dog");
                

                推荐答案

                你其实可以使用 wordwrap(),输入到 explode() 中,使用换行符 作为分隔符.explode() 将在 wordwrap() 产生的换行符上拆分字符串.

                You actually can use wordwrap(), fed into explode(), using the newline character as the delimiter. explode() will split the string on newlines produced by wordwrap().

                $strText = "The quick brown fox jumps over the lazy dog";
                
                // Wrap lines limited to 12 characters and break
                // them into an array
                $lines = explode("
                ", wordwrap($strText, 12, "
                "));
                
                var_dump($lines);
                array(4) {
                  [0]=>
                  string(9) "The quick"
                  [1]=>
                  string(9) "brown fox"
                  [2]=>
                  string(10) "jumps over"
                  [3]=>
                  string(12) "the lazy dog"
                }
                

                这篇关于str_split 没有自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:使用 PHP 将字符串分成两半(字识别) 下一篇:PHP 和 RegEx:用不在括号内(以及嵌套括号)的逗号分

                相关文章

                最新文章

                <i id='FeLBf'><tr id='FeLBf'><dt id='FeLBf'><q id='FeLBf'><span id='FeLBf'><b id='FeLBf'><form id='FeLBf'><ins id='FeLBf'></ins><ul id='FeLBf'></ul><sub id='FeLBf'></sub></form><legend id='FeLBf'></legend><bdo id='FeLBf'><pre id='FeLBf'><center id='FeLBf'></center></pre></bdo></b><th id='FeLBf'></th></span></q></dt></tr></i><div id='FeLBf'><tfoot id='FeLBf'></tfoot><dl id='FeLBf'><fieldset id='FeLBf'></fieldset></dl></div>

                    <bdo id='FeLBf'></bdo><ul id='FeLBf'></ul>
                  <legend id='FeLBf'><style id='FeLBf'><dir id='FeLBf'><q id='FeLBf'></q></dir></style></legend>
                1. <small id='FeLBf'></small><noframes id='FeLBf'>

                    <tfoot id='FeLBf'></tfoot>