Too big an array?

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
User avatar
php3ch0
Forum Contributor
Posts: 212
Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK

Too big an array?

Post by php3ch0 »

I am writing a forum script and I want to use an array to store the users last visit to show what topics are new.

it would be in the format

$array[ topic id] -> [last visit]

from here I would check the date of the most recent post agains the users last forum visit array for that topic.

Would this array bcome too large and slow things down considerably.

Is there a better way to do this?

Thanks
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Why do you need to store them in an array?

I don't know if there is a hardlimit to how big an array can be, but it's best to avoid using them for such large functionality.
User avatar
php3ch0
Forum Contributor
Posts: 212
Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK

Post by php3ch0 »

I dont need to use an array but would like suggestions on how to do this better.

It would be good to show new posts in top level category and sub categories updated as soon as the user has clicked on the category.

Dan
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

It's a lot to go into, but basically it comes down to using your tables instead of a mammoth array.
User avatar
php3ch0
Forum Contributor
Posts: 212
Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK

Post by php3ch0 »

Do you know of any tutorials you could point me in the direction of?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

There is a tutorial for making a forum, I've seen someone post it on these boards. I'm sure Google would find in no time, I don't have a link off the top of my head, sorry.
Post Reply