l::set PHP Method

set() static public method

Sets a language value by key
static public set ( mixed $key, mixed $value = null )
$key mixed The key to define
$value mixed The value for the passed key
    static function set($key, $value = null)
    {
        if (is_array($key)) {
            self::$lang = array_merge(self::$lang, $key);
        } else {
            self::$lang[$key] = $value;
        }
    }

Usage Example

示例#1
0
 public function testSet()
 {
     l::set('anothervar', 'anothervalue');
     l::set('testvar', 'overwrittenvalue');
     $this->assertEquals('anothervalue', l::get('anothervar'));
     $this->assertEquals('overwrittenvalue', l::get('testvar'));
     l::set(array('var1' => 'value1', 'var2' => 'value2'));
     $this->assertEquals('value1', l::get('var1'));
     $this->assertEquals('value2', l::get('var2'));
 }
All Usage Examples Of l::set