php8.5
Home/ Manual/ yaf / yaf_registry/ Yaf_Registry::del

Yaf_Registry::del

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Remove an item from registry

Description

Yaf_Registry::del(string $name): bool

Removes an entry from the registry. Removing a name that does not exist is silently accepted.

Parameters

name

The name of the registry entry.

Return Values

Always returns true.

Examples

Yaf_Registry::del example

php
<?php
Yaf_Registry::set("redis", new Redis());
var_dump(Yaf_Registry::has("redis"));

var_dump(Yaf_Registry::del("redis"));
var_dump(Yaf_Registry::has("redis"));

/* deleting a missing entry is silently accepted */
var_dump(Yaf_Registry::del("redis"));
?>

The above example will output something similar to:

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

See Also

  • Yaf_Registry::get
  • Yaf_Registry::set
  • Yaf_Registry::has

Source: reference/yaf/yaf_registry/del.xml · from the official PHP manual (php/doc-en)