Which is faster, a MySQL access, or a set of PHP variables?

From: Date: Fri, 30 Dec 2005 14:32:58 +0000
Subject: Which is faster, a MySQL access, or a set of PHP variables?
Groups: php.general 
Request: Send a blank email to php-general+get-228010@lists.php.net to get a copy of this message
PHP General, I have a site where I will set the interface up to be multilingual. This means that all the snippets of text which make up the menu and other elements of navigation common to most pages will be stored as variables. In most web site set ups that I have seen, especially on forums, the text is stored in a PHP script which is just a long list of variables. I wondered if there was any downside to storing the list of interface texts in a MySQL database, then calling them as an array when the page loads? This would have one minor advantage, which is that as I expand to new languages, I could build a simple web interface where people could input new languages into a form. However, is it a drag on a server to have to reach into the MySQL database to retrieve the array of texts each time the page loads? Note that the texts will be something like 20 to 30 small one to four word phrases like "contact" and "previous page" and that sort of thing. On the surface, it doesn't seem like this would be much different than accessing a PHP script with a list of variables. But then, I figured there might be a reason why I've never seen it done this way. Opinions would be much appreciated. -- Dave M G

« previous php.general (#228010) next »