I would like to localize my website so I'm making a JSON array containing variables for 3 different languages, like this:
{
"i18n_en":
[
"good"
],
"i18n_de":
[
"gut"
],
"i18n_ru":
[
"хорошо"
]
}
And so on... Obviously there's more words in there - and that's how I'm trying to use this in PHP:
<?php
$json = file_get_contents('/lang/i18n_en.json', true);
$obj = json_decode($json);
echo $obj[0]["good"];
?>
The above code echoes nothing. How can I echo a specific
item from a specific
JSON array using php? Something like:
For example I would like to echo the value of the key "good
" from the 118n_de
array on one page and echo the same key's value from the i18n_ru
array on another one. I'd really appreciate your help.