how to compare and replace values in two dimensional arrays

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
blueguy777
Forum Newbie
Posts: 2
Joined: Thu Jul 30, 2009 8:34 am

how to compare and replace values in two dimensional arrays

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

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

Post 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.
Post Reply