Foreach Runtime Methods count(), init(), restore()
Methods | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
public
|
init(
Smarty_Internal_Template $tpl,
mixed $from,
string $item,
bool $needTotal = false,
null|string $key = null,
null|string $name = null,
array $properties = [],
): mixed
Init foreach loop
- save item and key variables, named foreach property data if defined
- init item and key variables…
Init foreach loop
Parameters
Returns$from |
# | ||||||||||||
public
|
count(mixed $value): int
[util function] counts an array, arrayAccess/traversable or PDOStatement object
[util function] counts an array, arrayAccess/traversable or PDOStatement object Returnsthe count for arrays and objects that implement countable, 1 for other objects that don't, and 0 for empty elements |
# | ||||||||||||
public
|
restore(Smarty_Internal_Template $tpl, int $levels = 1)
Restore saved variables
Restore saved variables will be called by {break n} or {continue n} for the required number of levels Parameters
|
# |