Why am I still not getting an empty array?

Quote from here :

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

But why am I still not getting an empty array?

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

I get this:

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

UPDATE

Try it on Windows with PHP 5.2.8 (cli) (built: December 8, 2008 19:31:23)

+3
source share
3 answers

I can confirm that this does not work in PHP 5.2.8.

He works at PHP 5.2.11. In my opinion, there are a lot of errors in branch 5.2, so always try to use the latest version. 5.3 is more stable in my experience.

+1
source

. .

0

, : array(0) { }.
PHP 5.2.11.

, PHP. , ?

0

Source: https://habr.com/ru/post/1755923/


All Articles