ex-code.io expressions reference
The expression parser may be used to debug expressions.
constants
string constants are defined enclosed in single quotes eg. 'Hello world!'
integer constants are defined without quotes eg. 44
float constants are defined without quotes and include a decimal point or exponent eg. 3.142, 3E7
NULL, FALSE and TRUE
variables
variables can be defined without quotes if they do no include any special characters eg. name, surname
however if they contain special characters, example space, they must be enclosed in grave quotes eg. `name and surname`
operators
(in ascending order of precedence, operators with same precedence grouped together)
:= - assignment
OR - logical OR
XOR - logical XOR
AND - logical AND
NOT - logical NOT
= - is equal to
>= - is greater than or equal to
> - is greater then
<= - is less than or equal to
< - is less than
<> - is not equal to
!= - is not equal to
| - bitwise OR
^ - bitwise XOR
& - bitwise AND
- - subtraction
+ - addition
* - multiplication
/ - division
DIV - integer division
% - modulus
MOD - modulus
** - to the power of
|| - string concatenation
! - bitwise NOT
-> - access array element
functions
auth(user, pass)
attempts to authenticate user with pass, and returns true on success otherwise false
logout()
logout authenticated user
base64(data)
converts data to base64 and returns the result
urlencode(value)
converts value to url encoded string according to RFC 3986 and returns result
url_fillin(url)
replaces placeholders in url with values from variables and returns result
fillin(string)
replaces placeholders in string with values from variables and returns result
urlmerge(url, query_string)
merges the values passed in query_string into url overwriting values and returns result
xmail(to, subject, message)
sends an email
to - recipients seperated by semi-colon (;)
subject - email subject
message - email message
the following must be passed as variables:
mail_host - smtp host
mail_port - smtp port
mail_enc - smtp encryption, eg. "ssl", "tls", "" none
mail_user - smtp username
mail_pass - smtp password
mail_from - from email address
mail_name - from name
mail_rpto - reply to recipients seperated by semi-colon (;)
mail_cc - cc recipients seperated by semi-colon (;)
mail_bcc - bcc recipients seperated by semi-colon (;)
iif(condition, true_value, false_value)
if condition is true, outputs true_value else outputs false_value
htmlentities(text)
converts applicable characters in text to html entities and returns result
replace(text, what, with)
replaces occurences of what in text with with
char(ascii)
returns character of ascii
regex_match(text, regex)
returns true if text matches regex, otherwise returns false
ARRAY(element1[, element2 [, ...]])
returns an array with specified elements
curl(options)
executes a curl session with the specified options and returns the output
dump(variable)
returns a dump of variable in human readable html
Matthew