if ($item_fuera){ $i=0; foreach($itemsEnCesta as $k => $v) { if ($item_fuera==$k){ array_splice($itemsEnCesta,$i,1); } $i++; } }