phpexplode()返回值

myDCool發表於2012-02-28
<?php
$str = "abc:def:hij";
$arr = explode(`:`,$str);
echo `<pre>`;
echo `成功<br>`;
var_dump($arr);
echo `</pre>`;

$str = "abcdefhij";
$arr = explode(`:`,$str);
echo `<pre>`;
echo `no成功<br>`;
var_dump($arr);
echo `</pre>`;

  瀏覽器輸出結果:

成功
array(3) {
  [0]=>
  string(3) "abc"
  [1]=>
  string(3) "def"
  [2]=>
  string(3) "hij"
}

no成功
array(1) {
  [0]=>
  string(9) "abcdefhij"
}

  


相關文章