NYCPHP Meetup

NYPHP.org

[nycphp-talk] Change key values in array

Daniel Kushner nyphp at websapp.com
Thu May 20 13:36:06 EDT 2004


array_values()

-Daniel


> -----Original Message-----
> From: talk-bounces at lists.nyphp.org 
> [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Rafi Sheikh
> Sent: Thursday, May 20, 2004 13:31
> To: 'talk at lists.nyphp.org'
> Subject: [nycphp-talk] Change key values in array
> 
> Hi folks.  Is it possible to change the key value type in an 
> array?  I have an array that has string key values, for my 
> purposes I need it to have int index
> 
> NOW LOOKS LIKE:
> array(6) { ["04-01"]=> int(0) ["04-02"]=> string(2) "32" 
> ["04-03"]=> int(0) ["04-04"]=> int(0) ["04-05"]=> int(0) 
> ["04-06"]=> int(0) }
> 
> I NEED IT TO LOOK LIKE:
> array(6) { [0]=> int(0) [1]=> string(2) "32" [2]=> int(0) 
> [3]=> int(0) [4]=>
> int(0) [5]=> int(0) }
> 
> REASON:
> I am getting date value from a DB, and than doing an 
> array_merge with another template to ensure that any missing 
> month for a category get a zero in the correct sequence.  
> Problem is that, the resulting array needs to have int index 
> for the graphing utility to work.
> 
> TIA
> 
> 
> This e-mail, including attachments, may include confidential 
> and/or proprietary information, and may be used only by the 
> person or entity to which it is addressed. If the reader of 
> this e-mail is not the intended recipient or his or her 
> authorized agent, the reader is hereby notified that any 
> dissemination, distribution or copying of this e-mail is 
> prohibited. If you have received this e-mail in error, please 
> notify the sender by replying to this message and delete this 
> e-mail immediately.
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> 
> 





More information about the talk mailing list