For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > June 2005 > Re: setting values in associative array to 0









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: setting values in associative array to 0
Chung Leong

2005-06-07, 3:59 pm

For crying out loud, just use the stupid @ operator already. An
undefined entry will result in null, which gets typecast to 0.

@$array['beans']++ ;

@$array['carrots']++;

.... etc ...

Ewoud Dronkert

2005-06-07, 3:59 pm

On 7 Jun 2005 06:33:16 -0700, Chung Leong wrote:
> For crying out loud, just use the stupid @ operator already.
> @$array['beans']++ ;


I think his problem was not incrementing a certain element, but
resetting all elements to zero.


--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com