Sponsored Link

var

var tag assigns the constant and numbers written in the template to PHP variables.

Syntax

{{ @var val_name = 'String' }}
{{ @var val_name = num }}
{{ @var val_name = val_name2 }}

PHP

$assign['sample_var1']= 'PHP-String1';
$assign['sample_var2']['a2']= 'PHP-String2';

Template

{{ sample_var1 }}<br>
{{ @var sample_var1 = 'String1' }}
{{ sample_var1 }}<br>
<br>
{{ @var sample_var1 = 100 }}
{{ sample_var1 }}<br>
<br>
{{ sample_var2.a2 }}<br>
{{ @var sample_var2.a2 = 'String2' }}
{{ sample_var2.a2 }}<br>
<br>
{{ @var sample_var1 = sample_var2.a2 }}
{{ sample_var1 }}

Result

PHP-String1
String1

100

PHP-String2
String2

String2