php array problem
Posted: Fri Aug 20, 2004 3:54 pm
I've been having problems with php arrays for a while. Unfortunately it seems to happen randomly so I don't have a clue what's causing it.
It goes something like this:
$category[0]="name1";
$category[1]="name2";
Now, if I do this:
echo $category[0];
It will simply print "n" (the first character of "name1")
If I change the array name to $category2 it will work fine!
As I said, it happens randomly, sometimes on my local version of PHP 4.2.3 running under Windows XP, sometimes on my remote webserver (Linux running PHP 4).
Also, the array name doesn't have to be $category. It has happened using other names aswell.
Any help would be much appreciated!
It goes something like this:
$category[0]="name1";
$category[1]="name2";
Now, if I do this:
echo $category[0];
It will simply print "n" (the first character of "name1")
If I change the array name to $category2 it will work fine!
As I said, it happens randomly, sometimes on my local version of PHP 4.2.3 running under Windows XP, sometimes on my remote webserver (Linux running PHP 4).
Also, the array name doesn't have to be $category. It has happened using other names aswell.
Any help would be much appreciated!