Re: comparing arrays

2011-12-20 Thread roundrightfarm
thanks, I didn't notice your change the first time around On Dec 20, 10:14 am, euromark wrote: > thats not what i was saying > you sure can > and I already gave you the answer in the previous post :) > > On 20 Dez., 17:33, roundrightfarm wrote: > > > > > > > > > Thanks, > > To make sure I'm unde

Re: comparing arrays

2011-12-20 Thread euromark
thats not what i was saying you sure can and I already gave you the answer in the previous post :) On 20 Dez., 17:33, roundrightfarm wrote: > Thanks, > To make sure I'm undersatnding correctly, you can not change the > values in an array that is being scanned by foreach, you need to send > chang

Re: comparing arrays

2011-12-20 Thread roundrightfarm
Thanks, To make sure I'm undersatnding correctly, you can not change the values in an array that is being scanned by foreach, you need to send changes based on the scan to a new variable? This worked $weeks_prices = array(); foreach($discount_prices as $key => $discount_price){

Re: comparing arrays

2011-12-20 Thread euromark
basic php you cannot override $discount_price locally and expect it to change anything outside of the loop and the scope of this change if(!isset($discount_price)) $discount_prices[$key] = $item_prices[$key]; On 20 Dez., 16:37, roundrightfarm wrote: > The two arrays made with find() look like I

comparing arrays

2011-12-20 Thread roundrightfarm
The two arrays made with find() look like I would expect them to, but the foreach loop leaves $discount_prices (of which many have null values) unaffected. What am I missing here? //get regular prices $item_prices = $this->Item->find('list', array('fields' => array('Item.price'))

Re: Comparing arrays

2009-04-29 Thread Faza
Makes sense, I'll give it a try. Thanks! Brendon Kozlowski pisze: > I *think* you're looking for array_diff_uassoc -- > http://php.net/array_diff_uassoc > > On Apr 29, 2:15 pm, Faza wrote: > >> Hi guys, >> >> I'm curious if there is a built-in method to get an array which is a >> result of c

Re: Comparing arrays

2009-04-29 Thread Brendon Kozlowski
I *think* you're looking for array_diff_uassoc -- http://php.net/array_diff_uassoc On Apr 29, 2:15 pm, Faza wrote: > Hi guys, > > I'm curious if there is a built-in method to get an array which is a > result of comparing two other arrays with the same structure? > > Like > > $a = array('k1' =>

Comparing arrays

2009-04-29 Thread Faza
Hi guys, I'm curious if there is a built-in method to get an array which is a result of comparing two other arrays with the same structure? Like $a = array('k1' => 'v1', 'k2' => 'v2', 'k3' => '') $b = array('k1' => '', 'k2' => 'v2', 'k3' => 'yo momma') comparison of the two would give $c = a