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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php