is() public method

Compare value by key with somethig
public is ( string $key, mixed $compareWith = true, boolean $strictMode = false ) : boolean
$key string
$compareWith mixed
$strictMode boolean
return boolean
Beispiel #1
0
 public function testIs()
 {
     $data = new Data(array('key' => 1, 'nested' => array('key' => null)));
     isTrue($data->is('key'));
     isTrue($data->is('key', '1'));
     isTrue($data->is('key', 1));
     isTrue($data->is('key', true));
     isTrue($data->is('key', 1, true));
     isTrue($data->is('nested.key', null, true));
     isTrue($data->is('nested.key', false));
     isFalse($data->is('key', '1', true));
     isFalse($data->is('key', 1.0, true));
     isFalse($data->is('nested.key', '1', true));
     isFalse($data->is('nested.key', false, true));
 }