@isset - Checking If a Variable Is Set
The @isset
directive in Ahmed PHP Template Engine is used to check whether a variable has been defined and is not null
. It allows conditional rendering based on the presence of a variable.
Syntax
variable
is the variable being checked.The enclosed block of code executes only if the variable exists and is not
null
.
Example
Output
Notes
@isset
is useful for ensuring variables exist before displaying them.If the variable is not set, the enclosed block is skipped.
Can be combined with
@else
or@empty
for alternative behavior.
Last updated