Topic awaiting preservation: PHP,Arrays (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: |
posted 12-14-2002 22:37
Why is it. |
Maniac (V) Inmate From: under the bed |
posted 12-14-2002 22:47
answer 1 - because you declare it as $animals = array |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 12-14-2002 23:02
Cool!! |
Paranoid (IV) Inmate From: Milwaukee |
posted 12-15-2002 00:46
Bear in mind that if you typed |
Maniac (V) Inmate From: under the bed |
posted 12-15-2002 02:06 |
Paranoid (IV) Inmate From: Milwaukee |
posted 12-15-2002 02:56
Really? Weird. Just goes to show that if you've got an array that might be empty, check for content before outputting it. Thanks for the tip. |
Maniac (V) Inmate From: under the bed |
posted 12-15-2002 03:28 |
Paranoid (IV) Inmate From: Milwaukee |
posted 12-15-2002 03:59
Well, I can't imagine a situation where I'd want to try echoing an array directly... I always loop through the elements with a for, while, or foreach. And yeah, if I suspect the array might be empty, I check with something like "if (count($variable) > 0)". |
Maniac (V) Inmate From: under the bed |
posted 12-15-2002 05:54 |
Paranoid (IV) Inmate From: |
posted 12-15-2002 12:18
ahh ok.. well the deal is im writeing a |
Maniac (V) Inmate From: under the bed |
posted 12-15-2002 16:04
Trigger - my 1st reply gives you the function to do just that - print_r() |