[PHP] Count empty array

2006-12-21 Thread Kevin Murphy
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 the first

Re: [PHP] Count empty array

2006-12-21 Thread Robert Cummings
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; $array =

Re: [PHP] Count empty array

2006-12-21 Thread Jon Anderson
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 will = 2

Re: [PHP] Count empty array

2006-12-21 Thread Martin Marques
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 element:

Re: [PHP] Count empty array

2006-12-21 Thread tg-php
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