I got constant in PHP
This constant is written in Mysql
With Smarty i am doing output to HTML
Is it possible to output Smarty results to php not to HTML
<? {$CONSTANTS_RESULT[LOOP]} ?>
?
A constant is an identifier (name) for a simple value. The value cannot be changed during the script. A valid constant name starts with a letter or underscore (no $ sign before the constant name).
Yes, You can define an array as constant. From PHP 5.6 onwards, it is possible to define a constant as a scalar expression, and it is also possible to define an array constant. It is possible to define constants as a resource, but it should be avoided, as it can cause unexpected results.
A constant name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. If you have defined a constant, it can never be changed or undefined. To define a constant you have to use define() function and to retrieve the value of a constant, you have to simply specifying its name.
A constant can only be defined using define() function. It cannot be defined by any simple assignment. A variable can be defined by simple assignment (=) operator. There is no need to use the dollar ($) sign before constant during the assignment.
To access PHP constants in Smarty, you can use {$smarty.const.MY_CONSTANT}
which is documented here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With