I want to determine language of a webpage. I researched and found a couple of things:

There are 3 different ways that is used to mention the language:

1) the HTML tag
HTML Code:
<html lang="en">

2) In XHTML, the language is declared inside the <html> tag as follows:
HTML Code:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
3) The meta tag
HTML Code:
<meta http-equiv="Content-Language" content="ru"/>

Is there any other way ? Can any use use preg_match and give me a code/function that give me the language code ? (en, ru, gr, fr,etc etc) ?

Best Regards