From: Arlo L. <ar...@ar...> - 2009-02-21 03:21:43
|
Hello again, > If you're using explode(), you're probably expecting an array. Seems > normal to me.. Sure, I'm expecting an array, but I'm expecting it to be empty like the string it originated from. Let's say I get a field value from a database that is usually formatted like "1|2" but could also be "1" or "". If I leave it as a string, I can easily tell if it has data in it with a simple conditional. But if I explode the string to work with its individual elements, I can't easily tell anymore; count() returns 1 and empty() returns false even if the original value was "". I guess I could test for (implode(",", $array)), which returns false if the array consists only of one empty element. Or I could write a new function. Is there a better way? Since this comes up so often for me, it seemed like something that should be built in, but I'll settle for a more elegant workaround than the one I'm using now. Cheers, -Arlo _______________________________ Arlo Leach 773.769.6106 http://arlomedia.com |