現在の位置: ホーム> 関数カテゴリ一覧> str_split

str_split

文字列を配列に変換します
名前:str_split
カテゴリ:
対応言語:php
一言説明:文字列を配列に分割します。

例2

文字列「上海」を配列に分割します。

 <span class="token php language-php"><span class="token delimiter important"><?php</span>
<span class="token function">print_r</span> <span class="token punctuation">(</span> <span class="token function">str_split</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"shanghai"</span> <span class="token punctuation">)</span> <span class="token punctuation">)</span> <span class="token punctuation">;</span>
<span class="token delimiter important">?></span></span>

自分で試してみてください

例2

長さのパラメーターを使用します:

 <span class="token php language-php"><span class="token delimiter important"><?php</span>
<span class="token function">print_r</span> <span class="token punctuation">(</span> <span class="token function">str_split</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"shanghai"</span> <span class="token punctuation">、</span> <span class="token number">3</span> <span class="token punctuation">)</span> <span class="token punctuation">)</span> <span class="token punctuation">;</span>
<span class="token delimiter important">?></span></span>

自分で試してみてください

類似の関数
  • 1次元配列の値を文字列に変換します implode

    implode

    1次元配列の値を文字列に変換します
  • ロケール設定に基づく文字列の比較 strcoll

    strcoll

    ロケール設定に基づく文字列の比較
  • 「Natural Order」アルゴリズムを使用した文字列比較 strnatcmp

    strnatcmp

    「NaturalOrder」アルゴリズム
  • タグ分割文字列 strtok

    strtok

    タグ分割文字列
  • 文字列の最初の出現を見つけます strstr

    strstr

    文字列の最初の出現を見つけます
  • バックスラッシュを使用して文字列をエスケープします addslashes

    addslashes

    バックスラッシュを使用して文字列をエスケ
  • 文字列のMD5ハッシュ値を計算します md5

    md5

    文字列のMD5ハッシュ値を計算します
  • フォーマットされた文字列を返します vsprintf

    vsprintf

    フォーマットされた文字列を返します
人気記事(にんききじ)