View difference between Paste ID: 1Yh64pKC and gkKcSQuA
SHOW: | | - or go back to the newest paste.
1
<?php
2
3
$arr = array('a' => 123, 'b' => 456, 'loeschMich' => 789);
4
5
$gesucht = 789;
6-
foreach ($arr as $key => $element) {
6+
foreach ($arr as $key => &$element) {
7
    if ($key == $gesucht)
8
        break;
9
}
10
11
unset($arr[$key]);