$itemindex = array_search($i,$items);
if ($itemindex !== false) {
unset($items[$itemindex]);
}
Using separate variable and strict comparison you will only run unset() if an item was actually found from the array. Using !==
comparison to false you avoid confusing false with 0, since 0 is also a valid return value for array_search call, and in that case we do want to run unset().