views:

98

answers:

2

Hi, That´s a general question. I need do retrieve the value of about 20 strings of about 100 characters each. Which of the following methods would be the quickest, in order to retrieve the variables?

1) reading from a separate include file, where the variables values are assigned (e.g. $var1 = "blablablah...."; etc) 2) reading from a text file 3) reading from a (small) database - e.g. doing a simple mysql query

And what about a slightly larger case, e.g. about 50 strings up to 300 characters each?

Thank you

A: 

Which of the following methods would be the quickest, in order to retrieve the variables?

1) reading from a separate include file

And what about a slightly larger case, e.g. about 50 strings up to 300 characters each?

1) reading from a separate include file

It really depends on how much you value performance over practicality.

karim79
Of course, I only suggest that based on the data in your question, i.e. 50 strings up to 300 etc, and assuming it remains fairly static.
karim79
Yeah that's the case. Thanks a lot!
Yopi
+1  A: 

You've not included how many of these strings exist in your data set in total, and how often they're updated.

Using a wholly PHP-based solution or disc-files solution is fine when there are only a few of them and they're rarely updated; it becomes a management nightmare when there are 1bn and they get updated at a rate of thousands per minute.

Start with the most obvious (most maintainable) solution then optimise once performance becomes a problem and you're sure that's the source of it.

MarkR