PHP 8.6.0 Beta 3 is available for testing

Yaf_Config_Simple::set

(Yaf >=1.0.0)

Yaf_Config_Simple::setSet a configuration value

Опис

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

Sets a configuration value. Fails and returns false if the configuration is read-only.

Параметри

name

The configuration key to set.

value

The value to assign.

Значення, що повертаються

Returns true on success, or false if the configuration is read-only.

Приклади

Приклад #1 Yaf_Config_Simple::set() example

<?php
$config = new Yaf_Config_Simple(['env' => 'development']);

var_dump($config->set('env', 'production'));
echo $config->env, "\n";

// Read-only configurations reject the modification
$frozen = new Yaf_Config_Simple(['env' => 'development'], true);
var_dump($frozen->set('env', 'production'));
echo $frozen->env, "\n";
?>

Поданий вище приклад виведе щось схоже на:

bool(true)
production
bool(false)
development

Прогляньте також

add a note

User Contributed Notes

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