[UPHPU] easy asort() question

David Boucha boucha at gmail.com
Wed Jun 22 11:02:21 MDT 2005


On 6/22/05, Sheri <design5279 at gmail.com> wrote:
> 
> On 6/22/05, David Boucha <boucha at gmail.com> wrote:
> > 
> > >
> > >
> > > I don't think the output is wrong, I think it is how you are assigning
> > > the array that is wrong. Do the print statements like Mac suggested
> > > and see what your array looks like.
> > >
> > 
> > I agree.
> > 
> > $gradestudent[] = $math[$index].$student[$index];
> > 
> > This is your problem. You are just adding a value, so PHP is adding in
> > default keys for you. I bet your array looks something like this:
> > 
> > 0 => albert einstein - Grade B
> > 1 => isaac newton - Grade B
> > 2 => simon bolivar - Grade B
> > 3 => ivan the terrible - Grade C
> > 4 => napoleon - Grade C
> 
> 
> Right, but I think the array is actually like this: 
> 
> 0 => Grade Balbert einstein
> 1 => Grade Bisaac newton
> 2 => Grade Bsimon bolivar
> 3 => Grade Civan the terrible
> 4 => Grade Cnapoleon
> 


Yeah, you're probably right. Good catch.



More information about the UPHPU mailing list