Skip to content

Instantly share code, notes, and snippets.

@paddya
Created October 17, 2011 20:19
Show Gist options
  • Save paddya/1293676 to your computer and use it in GitHub Desktop.
Save paddya/1293676 to your computer and use it in GitHub Desktop.
// DB-Kram einbinden
$tunings = $db->get_results("SELECT * FROM tunings");
$by_component = array();
foreach($tunings AS $tuning) {
$by_component[$tuning['component']] = $tuning;
}
$delete = array();
foreach($by_component AS $component AS $ctunings) {
$keep = array();
foreach($ctunings AS $tuning) {
if(!isset($keep[$tuning['name']])) {
$keep[$tuning['name']] = true; // wir checken eh nur den Key, also reicht hier irgendwas !== null
} else {
$delete[] = $tuning['id'];
}
}
}
var_dump($delete);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment