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

Yaf_View_Simple::__isset

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Check whether a variable is assigned

Description

Yaf_View_Simple::__isset(string $name): bool

Checks whether a variable is assigned to the view. This method is called when isset() is used on a view object.

Parameters

name

The name of the variable to check.

Return Values

Returns true if a variable is assigned under name, false otherwise.

Examples

Yaf_View_Simple::__isset example

php
<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function indexAction()
    {
        $view = $this->getView();
        $view->assign("title", "Welcome");

        var_dump(isset($view->title));
        var_dump(isset($view->unknown));
    }
}
?>

The above example will output something similar to:

output
bool(true)
bool(false)

See Also

  • Yaf_View_Simple::assign
  • Yaf_View_Simple::get
  • Yaf_View_Simple::clear

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