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, null, 'tabelle_mannschaft'); foreach ($array as &$row) { $row = $lookup[$row['tabelle_mannschaft']] ?? array_shift($subset); } var_export($array);

preferences:
103.99 ms | 1304 KiB | 5 Q