@while - Looping Until a Condition is Met
The @while
directive in Ahmed PHP Template Engine allows you to execute a block of code repeatedly as long as a specified condition evaluates to true
.
Syntax
Example
Output (if $count = 1
initially)
$count = 1
initially)Notes
The loop continues execution as long as
condition
istrue
.Ensure the condition eventually becomes
false
to avoid infinite loops.You can modify the loop variable inside the loop using
@php
.
Last updated