Array question. Explode ends in Undefined offset: 1

Hi;
Why do I get Undefined offset: 1 ?

PHP Code:

$items = explode(“|”, $_POST[’selected_items’]);
        print_r($items);
        $unique_items = array();
        foreach($items as $val)
            {
                $item = explode(“-“,$val);
                if(count($item)>0){
                    $unique_items[][’item_type’] = $item[0];
                    $unique_items[][’item_id’] = $item[1];
                }
            } 

This […]

Original post by English Breakfast Tea

Leave a Reply