PHP 8.6.0 Beta 3 is available for testing

Yaf_Config_Simple::offsetGet

(Yaf >=1.0.0)

Yaf_Config_Simple::offsetGetGet a value (ArrayAccess)

Descrizione

public function Yaf_Config_Simple::offsetGet(mixed $name): mixed

Retrieves a configuration value by key. This method is an alias of Yaf_Config_Simple::get() and is called when array syntax is used to read a configuration object.

Elenco dei parametri

name

The configuration key to retrieve.

Valori restituiti

The value associated with name, or null if the key does not exist.

Esempi

Example #1 Yaf_Config_Simple::offsetGet() example

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

// Array values are wrapped in a Yaf_Config_Simple object
echo $config['application']->name, "\n";
echo $config['database']['host'], "\n";
var_dump($config['missing']);
?>

Il precedente esempio visualizzerà qualcosa simile a:

MyApp
localhost
NULL

Vedere anche:

add a note

User Contributed Notes

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