0

Array1 = array(000,400,000,500)

Array2 = array(300,400,450,500)

if the values of Array1 matches with Array2 values then the matching values of Array2 should be replaced with 000 i.e. Array2 = array(300,000,450,000)

somebody help me.

thanks in advance

2
Contributors
2
Replies
10
Views
4 Years
Discussion Span
Last Post by blueguy777
0

What about a for loop?

<?php
for($i = 0; $i < count($array_1); $i++)
{
    $record_1 = &$array_1[$i]; // The & creates a reference instead of copying the value.
    $record_2 = &$array_2[$i];

    if($record1 == $record_2)
    {
        $record_2 = '000';
    }
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.