Yaf_Config_Simple::offsetExists
PHP Manual
PHP Manual»Yaf_Config_Simple»Yaf_Config_Simple::offsetExists

Yaf_Config_Simple::offsetExists

(Yaf >=1.0.0)

Yaf_Config_Simple::offsetExists — Check if a key exists (ArrayAccess)

Beschreibung

public function Yaf_Config_Simple::offsetExists(mixed $name): bool

Checks whether a configuration key exists. This method is an alias of Yaf_Config_Simple::__isset() and is called when isset() is used with array syntax on a configuration object.

Parameter-Liste

name

The configuration key to check.

Rückgabewerte

Returns true if the key exists, false otherwise.

Beispiele

Beispiel #1 Yaf_Config_Simple::offsetExists() example

<?php
$config = new Yaf_Config_Simple([
    'application' => ['name' => 'MyApp'],
    'database'    => ['host' => 'localhost'],
]);

var_dump(isset($config['database']));
var_dump($config->offsetExists('database'));
var_dump(isset($config['cache']));
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

bool(true)
bool(true)
bool(false)

Siehe auch

To Top