@switch - Switch Case Statement
The @switch
directive in Ahmed PHP Template Engine allows you to execute different blocks of code based on the value of an expression, similar to a traditional switch
statement in PHP.
Syntax
Example
Output (if $status = 'pending'
)
$status = 'pending'
)Notes
The
@case
directive is used to define each case.The
@break
directive prevents fall-through behavior.The
@default
directive is optional and executes if no cases match.
Last updated