function foo() { $k = get_thing(); $y = get_two(); $x = "initial x value"; do_echo($x); try { $x = $y ? "ok1" : "ok2"; ${$k} = 3; goto heh; // needed or hphpc decides the assignment to $x can be removed } catch (Exception $e) { var_dump($x); return; } heh: var_dump($x); }
} public function render($context) { return join(' ', $this->contents); } } function do_echo($token) { return new EchoNode(py_slice(explode(' ', $token->contents), 1)); } $lib = new Library(); $lib->tag('echo', function ($parser, $token) { return do_echo($token); }); $lib->tag('other_echo', function ($parser, $token) { return do_echo($token); }); $lib->filter('upper', function ($value) { return strtoupper($value); }); DjaBase::$libraries['testtags'] = $lib; /* * Helper objects for template tests */ class SomeException extends Exception { public $silent_variable_failure = True; } class SomeOtherException extends Exception { }