I have translate function t($var);
function t($word) {
return $this->words[$word];
}
where $this->words is
You can define the t function like below :
function t($array)
{
return sprintf($array['sentence'],$array['word1'],$array['word1']);
}
Where array is :
$array = array(
'word1' => 'word',
'word2' => 'something',
'sentence' => 'Hello, my name is %s. I am %d years old.'
);
Call the function : echo t($array);