Bad design, basically.

This script is creating the array, then modifying a certain value in it
using the text key.  Later, it's referring to each value in the array by
numerical index.  Apparently, the text key and the numerical index do
not refer to the same values in PHP, so the value it's referring to with
the numerical index is the original value, not the one that was
modified.

I'm just going to spend the extra 5 minutes and rewrite that little
chunk of code.

---Matt

-----Original Message-----
From: Leif K-Brooks [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 04, 2003 12:39 AM
To: Matt Honeycutt
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Getting Numerical Index of a Key

No, there's no easy way to do this.  Just out of curiousity, why do you 
want to do this anyway?

Matt Honeycutt wrote:

>Because I created it with mysql_fetch_array().  I know for a fact that
>both keys exist, and I can look at the output and tell what text key
>matches to what numerical key, but I don't want to hardcode it like
>that.  The people that are taking over this code might change something
>and screw everything up.
>
>---Matt
>
>-----Original Message-----
>From: Leif K-Brooks [mailto:[EMAIL PROTECTED] 
>Sent: Tuesday, March 04, 2003 12:35 AM
>To: Matt Honeycutt
>Cc: [EMAIL PROTECTED]
>Subject: Re: [PHP] Getting Numerical Index of a Key
>
>What makes you think it HAS a numerical index?
>
>Matt Honeycutt wrote:
>
>  
>
>>Is there an easy way to get the numerical index of a text key for an
>>array?  I don't see anything in the manual, but before I waste time
>>writing code to find this info, I thought I would double check here.
>>
>>---Matt
>>
>> 
>>
>>    
>>
>
>  
>

-- 
The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent
of the law.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to