LoginSignup
4
5

More than 5 years have passed since last update.

[PHP]explode()の動作

Posted at

explode()がどう動作するか調べた

  • PHPのバージョン
    • PHP 5.6.10

こんなコードがあるじゃろ

$hoge1 = explode(',', null);
$hoge2 = explode(',', '');
$ages3 = explode(',', 0);
$hoge4 = explode(',', []);

$hoge1の結果

array:1 [
  0 => ""
]

$hoge2の結果

array:1 [
  0 => ""
]

$hoge3の結果

array:1 [
  0 => "0"
]

$hoge4の結果

explode() expects parameter 2 to be string, array given

以上。

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