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

Yaf_View_Simple::__set

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Assign a variable via property write

Description

Yaf_View_Simple::__set(string $name, mixed $value): void

Assigns a variable to the view. This method is called when writing to a property of a view object, and behaves the same as Yaf_View_Simple::assign.

Parameters

name

The name under which the variable becomes available to the template.

value

The value to assign.

Return Values

No value is returned.

Examples

Yaf_View_Simple::__set example

php
<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function indexAction()
    {
        $this->getView()->foo = "bar"; // same as assign("foo", "bar");
    }
}
?>

See Also

  • Yaf_View_Simple::assign
  • Yaf_View_Simple::get

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