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

Recommended Answers

All 2 Replies

What about a for loop?

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';

thanks minitauros

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.