3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ ['tabelle_mannschaft' => 'SV Winter'], ['tabelle_mannschaft' => 'Mannschaft 7'], ['tabelle_mannschaft' => 'TSV HORIZONT'], ['tabelle_mannschaft' => 'Mannschaft 8'], ]; $subset = [ ['tabelle_mannschaft' => 'TSV HORIZONT'], ['tabelle_mannschaft' => 'Mannschaft 7'], ]; $lookup = array_column($subset, 'tabelle_mannschaft', 'tabelle_mannschaft'); foreach ($array as $i => $row) { if (isset($lookup[$row['tabelle_mannschaft']])) { $array[$i] = array_shift($subset); } } var_export($array);

preferences:
81.82 ms | 1304 KiB | 5 Q