Skip to content

Commit 0725a8b

Browse files
committed
Added docs for using functions
1 parent e506f01 commit 0725a8b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

components/expression_language/syntax.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ JavaScript::
8181

8282
This will print ``Hi Hi Hi!``.
8383

84+
.. _component-expression-functions:
85+
86+
Working with Functions
87+
----------------------
88+
89+
You can also use registered functions in the expression by using the same
90+
syntax as PHP and JavaScript. The ExpressionLanguage component comes with one
91+
function by default: ``constant()`` Which will return the value of the PHP
92+
constant::
93+
94+
define('DB_USER', 'root');
95+
96+
echo $language->evaluate(
97+
'constant("DB_USER")'
98+
);
99+
100+
This will print ``root``.
101+
84102
.. _component-expression-arrays:
85103

86104
Working with Arrays

0 commit comments

Comments
 (0)