为什么我还没有得到一个空数组? [英] why I still don't get an empty array?

查看:87
本文介绍了为什么我还没有得到一个空数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从这里 报价:

Quoted from here:

如果定界符包含一个值,该值是
  不包含在串和负
  限制使用,那么空数组
  将返回,否则一个数组
  包含字符串将被退回。

If delimiter contains a value that is not contained in string and a negative limit is used, then an empty array will be returned, otherwise an array containing string will be returned.

但是,为什么我还没有得到一个空数组?

But why I still don't get an empty array?

var_dump(explode(',', '', -1))

我得到这样的:

array(1) {
  [0]=>
  string(0) ""
}

更新

试着在窗口,用PHP 5.2.8(CLI)(建:2008年12月8日19时31分23秒)

Try it in windows,with PHP 5.2.8 (cli) (built: Dec 8 2008 19:31:23)

推荐答案

我可以证实,这并不在工作 PHP 5.2.8

I can confirm that this doesn't work in PHP 5.2.8.

它在工作PHP 5.2.11 。在我看来,也有在5.2分支很多bug,所以尽量总是使用最新版本。 5.3更加稳定以我的经验。

It does work in PHP 5.2.11. In my opinion, there are many bugs in the 5.2 branch, so try always to use the latest version. 5.3 is more stable in my experience.

这篇关于为什么我还没有得到一个空数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆