PHP 8.6.0 Beta 3 is available for testing

Yaf_Config_Ini::offsetExists

(Yaf >=1.0.0)

Yaf_Config_Ini::offsetExistsCheck if a key exists (ArrayAccess)

Descrizione

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

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

Elenco dei parametri

name

The configuration key to check.

Valori restituiti

Returns true if the key exists, false otherwise.

Esempi

Example #1 Yaf_Config_Ini::offsetExists() example

<?php
/**
 * Assume /etc/myapp/application.ini contains:
 * [common]
 * application.name = "MyApp"
 * database.host    = "localhost"
 * database.port    = 3306
 */
$config = new Yaf_Config_Ini('/etc/myapp/application.ini', 'common');

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

Il precedente esempio visualizzerà qualcosa simile a:

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

Vedere anche:

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top