Re: help with arrays

From: Date: Thu, 16 May 2002 09:25:19 +0000
Subject: Re: help with arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-97887@lists.php.net to get a copy of this message
Josh Edwards wrote:
This is a basic question but I'm a basic fellow. If I have an array $timespread = array("12am-01am"=>0); $timespread["01am-02am"]=0; $timespread["02am-03am"]=0; etc Using $time which is a number, I want to add 1 to the value of $timespread[$time] without changing the key so if $time =1 I want to have $timespread["01am-02am"]=1; Using $timespread[$time]+=1; doesn't work.
Nope, you must say $timespread["01am-02am"] += 1

« previous php.general (#97887) next »