Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Yaf_View_Simple::evalYaf_View_Simple::getScriptPath>
^Yaf_View_SimpleLast updated: Mon, 26 Oct 2026

Yaf_View_Simple::get

(Yaf >=1.0.0)

Yaf_View_Simple::get — Get an assigned variable

Description

public function Yaf_View_Simple::get(string $name = NULL): mixed

Gets a variable previously assigned to the view. When called without an argument, all assigned variables are returned.

Parameters

name

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

Return Values

The value assigned under name, or null if there is no variable with that name. When called without an argument, an array of all assigned variables is returned.

Examples

Example #1 Yaf_View_Simple::get() example

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

        var_dump($view->get("foo"));
        var_dump($view->get()); // all assigned variables
    }
}
?>

The above example will output something similar to:

string(3) "bar"
array(1) {
  ["foo"]=>
  string(3) "bar"
}

See Also


<Yaf_View_Simple::evalYaf_View_Simple::getScriptPath>
^Yaf_View_SimpleLast updated: Mon, 26 Oct 2026