I have a quick question about which would the best way to implement
something in terms of performance. Using a database, or just creating
a big array in memory?

I have a PHP file manager script which creates an array of all
files in a directory, and get's their mime types. It then prints
these files to the browser with a little image or a word icon etc
for word documents.

So the data looks a bit like this:

+------+--------------------+---------------+----------+
| id   | mime_type          | description   | icon     |
+------+--------------------+---------------+----------+
|    0 | text/html          | HTML document | html.png |
|    1 | application/msword | Word document | word.png |
+------+--------------------+---------------+----------+

But this means for every file it comes across it needs
to do an SQL query to find the description and icon name.
Which doesn't seem very efficient.

Would it be better to just create a big array at the start
of my script with all this data in? That would seem more
efficient, and hence faster way of doing it?

Any feedback appreciated.

Paul

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to