Salve a tutti,
tramite explode creo un'array.
Ora vorrei fare in modo di poter modificare una voce di questo array.
Ho trovato il modo per cancellare la singola voce:
La variabile $nome è l'elemento da cancellare.codice:<? $items = explode(";",$meta_lista_valori); // this is presumably what you have so far $clean_inventory = array(); foreach($items as $item) { if( !isset($clean_inventory[$item])) $clean_inventory[$item] = 0; $clean_inventory[$item]++; } // now delete the item you want unset($clean_inventory[$nome]); // or, if you only want to remove one item, // $clean_inventory[$item_to_delete]--; // re-save in the "ugly" format... $saved = array(); foreach($clean_inventory as $item=>$quantity) { $saved = array_merge($saved,array_fill(0,$quantity,$item)); } $saved = implode(";",$saved); echo $saved; ?>
Non riesco invece a trovare una soluzione per modificare una voce.
Potete aiutarni

Rispondi quotando

, e tra l'altro potresti scrivere un codice più semplice)
