In general, there is

$nees = array(); foreach($json as $row) { $nees[$row[name]]=$row[value]; } 

and the second one is the same, but now how to compare name with another list in which name == name? I tried it like this:

 foreach($nees as $kk => $kkz) { foreach($nees2 as $kk2 => $kkz2) { if($kk==$kk2){ echo $kkz."\r";} } } 
  • 2
    It is difficult to understand when such an example, if you add examples of arrays and what you want to get it, then everything would be clear. - Yaroslav Molchan
  • if($kk==$kk2){ echo $kk; echo $nees[$kk]; echo $nees2[$kk];} if($kk==$kk2){ echo $kk; echo $nees[$kk]; echo $nees2[$kk];} if($kk==$kk2){ echo $kk; echo $nees[$kk]; echo $nees2[$kk];} - Jean-Claude

1 answer 1

If you have 2 arrays with the same structure, i.e. name => value, then there is the next option (there are many)

 foreach($nees as $name=>$value){ if (isset($nees2[$name])){ //пишешь то что ты хочешь сделать например echo $name.','.$value.','.$nees2[$name]; } } 

(Either I am a fool or skis do not go)

  • thanks a lot) works) - Kivan
  • Mark that you gave the answer, and then they will think something) - Vsevolod Ryabchikov