potresti farti un array per ogni codice.
$cod1['nome']['qta']
$cod2['nome']['qta']
ecc. ecc.

oppure un singolo array $cod['index']['nome']['qta']