My target is to assign a number to the string in the array.
$lang = array (
'title' => "Der Anti-Spam Dienst",
'button-login' => "Jetzt $number via Twitter anmelden."
);
The $number should be set like $lang[‘button-login’][5] – but I don’t have any idea how to access the variable in the array.
maybe you can help me.
Thanks!
You should declare the
$numbervariable before the array:Update: If you want to set it afterwards, you’ll have to use
str_replace:See it here in action: http://viper-7.com/7QtpF7
Note: the strings should be surrounded by single quotes, so that
$numberis not parsed as a variable.