Re: Multidimensional Array manipluation...

From: Date: Thu, 02 Jan 2003 17:55:47 +0000
Subject: Re: Multidimensional Array manipluation...
Groups: php.general 
Request: Send a blank email to php-general+get-129966@lists.php.net to get a copy of this message
Hi, Well, I will be having something like this: $se5f2254321s65s32s65[] will hold various valus like jan_1,jan-2,jan_3,jan_4 etc and then jan_1 will hold 1, jan_2=2,, jan_3=1 etc etc... Depending on certain conditions, I want to increment the values of certain values in the array...like... for($i=0; $i<=count($se5f2254321s65s32s65); $i++) { $se5f2254321s65s32s65[$i]["jan_1"] = 1 } I want to increment it with 1 and so on for the various other values.... Thanx Best Regards, Dhaval
From: Chris Shiflett <shiflett@php.net> Reply-To: shiflett@php.net To: Dhaval Desai <da_linuxguru@hotmail.com> CC: php-general@lists.php.net Subject: Re: [PHP] Multidimensional Array manipluation... Date: Thu, 2 Jan 2003 09:30:43 -0800 (PST)
$test["0"]["hey"] = 1; $test["1"]["hi"] = 2; $test["2"]["hello"] = 3;
I want to update $test["0"]["hey"] and set it as 1+1; If you just want to increment the value: $test["0"]["hey"]++; Also is there any idea on how can we count() the values in a multi dimensional arrays... The function array_count_values() might give you what you want. What are you wanting to count exactly? A good reference for you online is: http://www.php.net/manual/en/ref.array.php Chris
_________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

« previous php.general (#129966) next »