Still no luck. I think I merged the 2 arrays too soon.
I get a list of Posts from a search. Then run a function to determine the
percentage match for the results based which spits out a $percentage array
for each of the $posts array
So I have 2 separate arrays to work with, and stuck on combine / merge them
into 1 array matching up the keys
so originally i have the lists of Post id's
Array
(
[Posts] => Array
(
[0] => 3
[1] => 4
[2] => 5
[3] => 6
[4] => 7
[5] => 8
)
)
Then a Percentage for each of the Posts
Array
(
[Percent] => Array
(
[0] => 36
[1] => 85
[2] => 25
[3] => 17
[4] => 85
[5] => 17
)
)
And end up with 1 array where the keys are matched up for each as every Post
will have a partner Percentage
________________________________
From: mike karthauser [mailto:[email protected]]
Sent: June-21-09 10:08 AM
To: [email protected]
Subject: Re: Array Help
hi dave
On 21 Jun 2009, at 13:35, Dave Maharaj :: WidePixels.com wrote:
How can I edit this array:
Array
(
[Test] => Array
(
[Post] => Array
(
[0] => 3
[1] => 4
[2] => 5
[3] => 6
[4] => 7
[5] => 8
[6] => 9
)
[Percent] => Array
(
[0] => 28
[1] => 39
[2] => 17
[3] => 28
[4] => 23
[5] => 17
[6] => 17
)
)
)
Into something like : take each key from POST and PERCENT, and pair
them up
Array
(
[Test] => Array
(
[0] => Array
(
[Post] => 3
[Percent] => 28
)
)
)
by using set::extract
http://debuggable.com/posts/cake-12s-set-class-eats-arrays-for-breakfast
YMMV
regards
mikek
--
Mike Karthäuser
Managing Director - Brightstorm Ltd
Email: [email protected]
Web: http://www.brightstorm.co.uk <http://www.brightstorm.co.uk/>
Tel: 07939 252144 (mobile)
Fax: 0870 1320560
Address: 1 Brewery Court, North Street, Bristol, BS3 1JS
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---