Not sure why it does it, but doesn't seem to be a huge deal. I'm guessing it's
because an empty string is still a string. It's not null.
Anyway, it's documented at:
http://us3.php.net/manual/en/function.explode.php
A user writes:
"If you split an empty string, you get back a one-element array
On Thu, 21 Dec 2006, Kevin Murphy wrote:
I'm wondering why this is.
$data = "";
$array = explode(",",$data);
$count = count($array);
$count will = 1
$array has 1 element: An empty string.
$data = "Test";
$array = explode(",",$data);
$count = count($array);
$count will = 1
$array has 1 ele
Kevin Murphy wrote:
I'm wondering why this is.
$data = "";
$array = explode(",",$data);
$count = count($array);
$count will = 1
$data = "Test";
$array = explode(",",$data);
$count = count($array);
$count will = 1
$data = "Test,Test";
$array = explode(",",$data);
$count = count($array);
$count
On Thu, 2006-12-21 at 13:31 -0800, Kevin Murphy wrote:
> I'm wondering why this is.
>
> $data = "";
> $array = explode(",",$data);
> $count = count($array);
> $count will = 1
>
> $data = "Test";
> $array = explode(",",$data);
> $count = count($array);
> $count will = 1
>
> $data = "Test,Test";
>
I'm wondering why this is.
$data = "";
$array = explode(",",$data);
$count = count($array);
$count will = 1
$data = "Test";
$array = explode(",",$data);
$count = count($array);
$count will = 1
$data = "Test,Test";
$array = explode(",",$data);
$count = count($array);
$count will = 2
Why doesn't
5 matches
Mail list logo