php8.5
Home/ Manual/ yaf / yaf_view_simple/ Yaf_View_Simple::clear

Yaf_View_Simple::clear

PHP function Edit on GitHub ✎

(Yaf >=2.2.0)

Remove an assigned variable

Description

Yaf_View_Simple::clear(string $name = NULL): bool

Removes an assigned variable from the view. When called without an argument, all assigned variables are removed.

Parameters

name

The name of the variable to remove, or omitted/null to remove all assigned variables.

Return Values

Returns true.

Examples

Yaf_View_Simple::clear example

php
<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function indexAction()
    {
        $this->getView()->clear("foo")->clear("bar"); // clear "foo" and "bar"
        $this->_view->clear(); // clear all assigned variables
    }
}
?>

See Also

  • Yaf_View_Simple::assign
  • Yaf_View_Simple::get

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