Voting

: max(four, seven)?
(Example: nine)

The Note You're Voting On

matthias dot isler at gmail dot com
15 years ago
If you want to load some translations for your application, don't use csv files for that, even if it's easier to handle.

The following code snippet:

<?php
$lang
= array();

$handle = fopen('en.csv', 'r');

while(
$row = fgetcsv($handle, 500, ';'))
{
$lang[$row[0]] = $row[1];
}

fclose($handle);
?>

is about 400% slower than this code:

<?php
$lang
= array();

$values = parse_ini_file('de.ini');

foreach(
$values as $key => $val)
{
$lang[$key] = $val;
}
?>

That's the reason why you should allways use .ini files for translations...

http://php.net/parse_ini_file

<< Back to user notes page

To Top