View Single Post
Old 04-18-2008, 02:32 AM   #3 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

I'm quite unsure of what you're asking, but have you tried the serialize and unserialize functions? If you're also asking how to read and write, I think I have covered everything you may need to know in the code below.

php Code:
$aItems = array();
$szFile = 'items.txt';

if(file_exists($szFile))
{
    $szContent = file_get_contents($szFile);
    $aItems = unserialize($szContent);
}

$aItems[] = array
(
    'Name' => 'Adam',
    'Email' => 'adam@example.com'
);

file_put_contents($szFile, serialize($aItems));
printf('Items in file: %d', count($aItems));
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote