Having issues with going from fopen -> serialize

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
deethree
Forum Newbie
Posts: 1
Joined: Sun Jul 20, 2003 11:06 pm

Having issues with going from fopen -> serialize

Post by deethree »

I've got this flatfile link script I'm working on... and I was told that serialize() would be a good thing to try to use. I think I understand the terminology behind the whole idea... and I've checked out php.net and google and what have you.

So I thought I'd apeal to the general population seeing how there are a lack of tutorials/help on the subject.

Right now I have the file set as:
number|user|link|name|hits

And I can read the text file and thats all ok. Its just trying to overwrite a certain entry to update the # of hits that gives me an issue.

Code: Select all

<?php
//   This is what I have for the normal text file.
$fp = fopen($filename, "r");
$file_contents = fread($fp, filesize($filename));
fclose($fp);
$line = explode("\n", $file_contents);
$i = 0;
$size = sizeof($line) - 1;
?>
I was just wondering if someone could give me an idea on modifing this to suit serialize() or point me to a resource that might deal with it or something.

Thanks,
d3.
Post Reply