Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
Liquid Web Managed Dedicated Server: RAID 1 SSD with 16GB of RAM minimum! 24/7 On-Site Heroic Support! Industry-Leading SLA!

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Liquid Web Cloud VPS Hosting

8,505 questions

11,788 answers

573 users

How to create simple array for multi-language website in PHP

2 Answers

0 votes
$lang = 'english';
  
$arr[0]['key'] = 'site_title';
$arr[0]['english'] = "Collective Solver";
$arr[0]['gibberish'] = "a@sd a7de kd@#";

$arr[1]['key'] = 'site_url';
$arr[1]['english'] = "collectivesolver.com";
$arr[1]['gibberish'] = "a23ds6@3d!.com";
  
if ($lang == 'english')
    foreach ($arr as $i=>$val)
        $language[$arr[$i]['key']] = $arr[$i]['english'];
        
if ($lang == 'gibberish')
    foreach ($arr as $i=>$val)
        $language[$arr[$i]['key']] = $arr[$i]['gibberish'];
    
echo $language['site_title'] . "<br />";
echo $language['site_url'] . "<br />";

  
/*
run: 
 
Collective Solver
collectivesolver.com
   
*/

 




answered Jun 8 by avibootz
0 votes
$lang = 'gibberish';
  
$arr[0]['key'] = 'site_title';
$arr[0]['english'] = "Collective Solver";
$arr[0]['gibberish'] = "a@sd a7de kd@#";

$arr[1]['key'] = 'site_url';
$arr[1]['english'] = "collectivesolver.com";
$arr[1]['gibberish'] = "a23ds6@3d!.com";
  
if ($lang == 'english')
    foreach ($arr as $i=>$val)
        $language[$arr[$i]['key']] = $arr[$i]['english'];
        
if ($lang == 'gibberish')
    foreach ($arr as $i=>$val)
        $language[$arr[$i]['key']] = $arr[$i]['gibberish'];
    
echo $language['site_title'] . "<br />";
echo $language['site_url'] . "<br />";


  
/*
run: 
 
a@sd a7de kd@#
a23ds6@3d!.com
   
*/  

 




answered Jun 8 by avibootz
...