If you know the position in the array you can use the unset (); directly
unset($input[0]);
To be clearer:
$input = array("item 2", "item 4");
var_dump($input);
unset($input[0]);
var_dump($input);
Gives:
array(2) {
[0]=>
string(6) "item 2"
[1]=>
string(6) "item 4"
}
array(1) {
[1]=>
string(6) "item 4"
}
If you do not know the position in the array you must go through the array or use array_search () first and then unset()
$key = array_search('item 2', $input);
if($key!==false){
unset($input[$key]);
}
Example:
$input = array("item 2", "item 4");
$key = array_search('item 2', $input);
if($key!==false){
unset($input[$key]);
}
var_dump($input);
What gives
array(1) {
[1]=>
string(6) "item 4"
}