multiplos de 1 php code example
Example: multi lang php
<?php
$trans = [
'en' => [
'user_where_are_you_text' => 'Where are You, %s? It is me, %s! I am waiting here for %s hours!',
],
'fr' => [
'user_where_are_you_text' => 'Où es-tu, %s? C\'est moi, %s! J\'attends ici depuis %s heures!'
],
];
$name = 'Loz';
$name1 = 'Rasmus';
$time = 3;
function __($key, ...$arguments) {
global $trans, $lang;
return sprintf($trans[$lang][$key], ...$arguments);
}
$lang = 'en';
echo __('user_where_are_you_text', $name, $name1, $time).PHP_EOL;
$lang = 'fr';
echo __('user_where_are_you_text', $name, $name1, $time).PHP_EOL;