Page 1 of 1

how to compare and replace values in two dimensional arrays

Posted: Sat Sep 14, 2013 10:32 am
by blueguy777

Code: Select all

$a = array(000,400,000,500);
    $b = array(300,400,450,500);
    
    $i=0;
    foreach($b as $k=>$v)
    {
        if($v==$a[$i])
        {
            $b[$k]='000';
        }
        $i++;
    }
    
    print_r($b);
i want same thing in two dimensional array

$a = Array ( [0] => Array ( [0] => 000000 [1] => 000400 [2] => 000450 ) [1] => Array ( [0] => 000350 [1] => 000400 ) )

$b = array(0=>000350,1=>000400,2=>000450) //pre-defined installment amount values

Re: how to compare and replace values in two dimensional arr

Posted: Sat Sep 14, 2013 7:47 pm
by requinix
I don't see how you're supposed to get that output. Explain what you're trying to do, don't just post code that doesn't work.