PHP 8.6.0 Beta 3 is available for testing

Yaf_Config_Abstract::set

(Yaf >=1.0.0)

Yaf_Config_Abstract::setSet a configuration value

Beschreibung

abstract public function Yaf_Config_Abstract::set(string $name, mixed $value): bool

Sets a configuration value. This method is abstract and must be implemented by subclasses. Read-only configurations will reject modifications.

Parameter-Liste

name

The configuration key to set.

value

The value to assign.

Rückgabewerte

Returns true on success, or false on failure (e.g. when the configuration is read-only).

Beispiele

Beispiel #1 Yaf_Config_Abstract::set() example

<?php
$config = new Yaf_Config_Simple(['env' => 'development']);
var_dump($config->set('env', 'production'));
echo $config->env, "\n";

// Read-only implementations reject the modification
$ini = new Yaf_Config_Ini('/etc/myapp/application.ini', 'common');
var_dump($ini->set('env', 'production'));
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

bool(true)
production
bool(false)

Siehe auch

add a note

User Contributed Notes

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