I tried extract / merge / combine / tried regular array functions push and I
just cant get this.
Read the eat arrays for breakfast link but I am not extracting from a path,
id's are already extracted thru a search and percent is a function run on
each extracted id. Now I need to create an array to pass to pagination that
has the percent and id
Tried foreach loops and still nothing.
Can someone point out how to exactly get the pairs for each key to create an
array for each
I have 2 separate arrays, one is just the id's the other is the percentage
Id's:
Array
(
[0] => 3
[1] => 4
[2] => 5
[3] => 6
[4] => 7
}
Percent array:
Array
(
[0] => 28
[1] => 39
[2] => 17
[3] => 28
[4] => 23
So it would end up like:
Array
(
[0] => Array
(
[id] => 3
[percent] => 28
)
[1] => Array
(
[id] => 4
[percent] => 39
)
[2] => Array
(
[id] => 5
[percent] => 17
)
[3] => Array
(
[id] => 6
[percent] => 28
)
[4] => Array
(
[id] => 7
[percent] => 23
)
)
Thanks,
Dave
-----Original Message-----
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
-~----------~----~----~----~------~----~------~--~---