0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

explode関数の使い方

Last updated at Posted at 2018-03-25

explode関数を使うことで、区切り文字列を配列に変換することができます。
第一引数に区切り文字列、第二引数に入力文字列をとります。

(例)

echo $a[0]; //hopが出力される
echo $a[1]; //stepが出力される
echo $a[2]; //jumpが出力される```

今回の入力文字列の"hop_step_jump"の区切り文字列は"_"なので、第一引数に"_"を取っています。
もし入力文字列が"hop,step,jump"ならば、
explode(",","hop,step,jump")
という記述になります。

参考
http://php.net/manual/ja/function.explode.php
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?