String Case Conversion - @strtoupper, @strtolower, and @ucfirst
The @strtoupper, @strtolower, and @ucfirst directives in Ahmed PHP Template Engine allow you to modify the case of text dynamically.
Syntax
@strtoupper(text)
@strtolower(text)
@ucfirst(text)@strtoupperconverts the giventextto uppercase.@strtolowerconverts the giventextto lowercase.@ucfirstcapitalizes the first letter of the giventext.
Example
@set(name, 'ammar')
<p>@strtoupper(name)</p>
<p>@strtolower(name)</p>
<p>@ucfirst(name)</p>Output
<p>AMMAR</p>
<p>ammar</p>
<p>Ammar</p>Notes
Useful for formatting text dynamically in templates.
Works with both variables and static strings.
Can be combined with other directives for more complex string manipulations.
Last updated