regoch Posted January 10, 2012 Share Posted January 10, 2012 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 More sharing options...
Pikachu2000 Posted January 10, 2012 Share Posted January 10, 2012 You almost had it . . . <?php echo $redak['novost_naslov_' . $home_jezik]; ?> Link to comment https://forums.phpfreaks.com/topic/254740-variable-language/#findComment-1306235 Share on other sites More sharing options...
Psycho Posted January 10, 2012 Share Posted January 10, 2012 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 More sharing options...
regoch Posted January 10, 2012 Author Share Posted January 10, 2012 version 2 worked, thanks! Link to comment https://forums.phpfreaks.com/topic/254740-variable-language/#findComment-1306242 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.