You could have include files that supply strings translated into various languages, e.g., have a 'text_en.php' which says
$welcome='Welcome!';
a text_fr.php page which says
$welcome='Bienvenue!';
and a text_de.php saying
$welcome='Willkommen!';
And then have a "lang_select.php" file which you include() on each language-aware page that has something like:
include('text_en.php');
if($language=='fr')
{ include('text_fr.php');
}
elseif($language=='de')
{ include('text_de.php');
}
...
After that, you'd say "$welcome" instead of "Welcome!". This may be better than rewriting the entire page multiple times - once for each language - which is how Apache's language-selection would work, because you don't need to duplicate all your formatting, layout, and scripting for every language.
Note that I'm including 'text_en.php' unconditionally at the start. You may want to do this or you may not. I'm doing it here to provide defaults for every string, to be used if there are any on the page that you don't yet have translations for in the chosen language.
Now it's just a matter of figuring out what $language should be. If the browser sends one, then a list of languages it accepts will appear in $HTTP_ACCEPT_LANGUAGE. It will be a comma-separated list, looking a bit like "en-nz, en;q=0.80, en-gb;q=0.60, en-au;q=0.40, en-us;q=0.20"
You can ignore the q= quality settings. The list is in order of decreasing preference, so try and use the first one that you can cater for. For example, if the browser says "af, da, de, en" meaning "Afrikanns, Dutch, German, English" and you don't have an Afrikaans version, use the Dutch one.
The code for handling this would also be on 'lang_select.php'. You may want to stash it in a session variable or suchlike for convenience on subsequent pages, and check if that's already set on each use of the lang_select page to save parsing and reparsing $HTTP_ACCEPT_LANGUAGE every time.
A complete list of the ISO639-1 language codes is at
http://www.loc.gov/standards/iso639-2/langcodes.html