カンマ区切りの文字列を配列に分割しますか? 質問する

カンマ区切りの文字列を配列に分割しますか? 質問する

文字列入力をコンマで配列に分割する必要があります。

カンマ区切りの文字列をフラットなインデックス付き配列に分解する方法はありますか?

入力:

9,[email protected],8

出力:

['9', 'admin@example', '8']  

ベストアンサー1

試す爆発する:

$myString = "9,[email protected],8";
$myArray = explode(',', $myString);
print_r($myArray);

出力:

Array
(
    [0] => 9
    [1] => [email protected]
    [2] => 8
)

おすすめ記事