Esempio:
file utenti.txt
file che importa i daticodice:gianni:uno luigi:due franco:tre mario:quattro andrea:cinque
per aggiungere altri dati in coda al file utenti.txtcodice:<?php $utenti = array(); $lines = file('utenti.txt'); foreach ($lines as $line) { list($key, $value) = split(":", $line); $utenti[$key] = $value; } ?>
codice:<?php $data = "giorgio:sei\n"; file_put_contents('utenti.txt', $data, FILE_APPEND); ?>