Re: Dazed and Confused

From: Date: Wed, 30 Oct 2002 18:23:04 +0000
Subject: Re: Dazed and Confused
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-122079@lists.php.net to get a copy of this message
Because you haven't put anything in array index 0. The only array index that has anything is "test". There is no difference between numeric and string indices. You seem to be assuming that somehow the first element in an array can always be accessed as index 0 which is not the case and never has been. -Rasmus On Wed, 30 Oct 2002, PHP List wrote: > For some reason my brain is not operating within normal parameters this week. > > $myarray["test"] = "sd"; > echo $myarray[0]; > > Why will nothing echo? Do I somehow have to initialize indexing on the array $myarray? > php says that $myarray is an array, but I can't access it with numeric indexes. > > I know if I do this: > $myarray = array("test"=>"sd"); > that I can now echo $myarray[0] and get the value of sd returned. > >

« previous php.general (#122079) next »