Jump to content

variable language


regoch

Recommended Posts

I got site wirch I like tu turn to multilanguage.

<?=$home_jezik?>

This is my variable for language code. So I wonna add it to

<?php echo $redak['novost_naslov_hr']; ?>

so that  "hr" change to "en" or any other language. I try with this but nothing happens

<?php echo $redak['novost_naslov_.$home_jezik']; ?>

Link to comment
https://forums.phpfreaks.com/topic/254740-variable-language/
Share on other sites

Pikachu2000 beat me to it, but I've provided some add'l info, so I'll post anyway.

 

You have two problems in what you are doing. 1) Variables are not parsed inside single quoted strings and 2) You cannot concatenate strings inside the quotes like that. You would need to use double quotes (without the concatenate character - period) or append the string outside the quotes using either single or double quotes.

 

echo $redak["novost_naslov_$home_jezik"];

 

Or

 

echo $redak['novost_naslov_' . $home_jezik];

Link to comment
https://forums.phpfreaks.com/topic/254740-variable-language/#findComment-1306238
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.