Skip to content

Instantly share code, notes, and snippets.

@Committing
Last active October 22, 2016 19:35
Show Gist options
  • Save Committing/8b80ebd6e9d56e0b026887de5025d790 to your computer and use it in GitHub Desktop.
Save Committing/8b80ebd6e9d56e0b026887de5025d790 to your computer and use it in GitHub Desktop.
<?php
class Language {
public $language = '';
public $phrases = array(
'UK' => array(
'hello' => 'Ello gov\'na ',
'goodbye' => 'Good day!'
),
'AUS' => array(
'hello' => 'Alight mate? ',
'goodbye' => 'See ya later, mate'
)
);
public function __construct($language = 'UK')
{
$this->language = $language;
}
public function say($phrase_key = 'hello')
{
return $this->phrases[$this->language][$phrase_key];
}
}
$language = new Language('AUS');
echo $language->say('goodbye');
// See ya later, mate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment