PHP, MYSQL, CSS, LINUX TUTORIALS

Video tutorial: Simple Multi Language Site Example

This mini tutorial shows you the basic of how to create a multi language website with php.

<?php
 
	include('lang.php');
	$default = ($_GET['lang']=='') ? 'en' : $_GET['lang'];
 
	echo $lang[$default]['hello'].','.$lang[$default]['my_name'].' John Doe';
 
?>
<?php
 
	$lang = array(
		'en'=-->array(
			'hello'=&gt;'Hello',
			'my_name'=&gt;'My name is'
		),
		'fr'=&gt;array(
			'hello'=&gt;'Bonjour',
			'my_name'=&gt;'J\'appelle'
		),
		'es'=&gt;array(
			'hello'=&gt;'Holla',
			'my_name'=&gt;'Me llaman'
		)
	);
 
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>