Expression Manager/175/en: Difference between revisions
From LimeSurvey Manual
(Importation d’une nouvelle version depuis une source externe.) |
(Importing a new version from external source) |
||
Line 22: | Line 22: | ||
|[http://www.php.net/manual/en/function.cos.php cos]||Cosine||number cos(number) | |[http://www.php.net/manual/en/function.cos.php cos]||Cosine||number cos(number) | ||
|- | |- | ||
|count||count the number of answered (non-blank)questions in the list||number count(arg1, arg12, ..., argN) | |count||count the number of answered (non-blank) questions in the list||number count(arg1, arg12, ..., argN) | ||
|- | |- | ||
|countif||Count the number of answered questions in the list equal the first argument||number countif(matches, arg1, arg2, ... argN) | |countif||Count the number of answered questions in the list equal to the first argument||number countif(matches, arg1, arg2, ... argN) | ||
|- | |- | ||
|countifop||Count the number of answered questions in the list which pass the criteria (arg op value)||number countifop(op, value, arg1, arg2, ... argN) | |countifop||Count the number of answered questions in the list which pass the criteria (arg op value)||number countifop(op, value, arg1, arg2, ... argN) | ||
Line 48: | Line 48: | ||
|[http://www.php.net/manual/en/function.idate.php idate]||Format a local time/date as integer||string idate(string <nowiki>[</nowiki>, timestamp=time()]) | |[http://www.php.net/manual/en/function.idate.php idate]||Format a local time/date as integer||string idate(string <nowiki>[</nowiki>, timestamp=time()]) | ||
|- | |- | ||
|if||Excel-style if(test,result_if_true,result_if_false)||if(test,result_if_true,result_if_false) | |if{{UpdatedIn|3.0.2}}||Excel-style if(test,result_if_true<nowiki>[</nowiki>,result_if_false = ""<nowiki>]</nowiki>)||if(test,result_if_true<nowiki>[</nowiki>,result_if_false = ""<nowiki>]</nowiki>) | ||
|- | |- | ||
|[http://www.php.net/manual/en/function.implode.php implode]||Join array elements with a string||string implode(glue,arg1,arg2,...,argN) | |[http://www.php.net/manual/en/function.implode.php implode]||Join array elements with a string||string implode(glue,arg1,arg2,...,argN) | ||
Line 71: | Line 71: | ||
|- | |- | ||
|list||Return comma-separated list of non-blank values||string list(arg1, arg2, ... argN) | |list||Return comma-separated list of non-blank values||string list(arg1, arg2, ... argN) | ||
|- | |||
|listifop{{NewIn|3.16.1}}||Return a 'glue'-separated list of the specified question property (retProp) from questions in the list which pass the criteria (cmpProp op value)||string listifop(cmpProp, op, value, retProp, glue, sgqa1, sgqa2, ... sgqaN) | |||
|- | |- | ||
|[http://www.php.net/manual/en/function.log.php log]|| The logarithm of number to base, if given, or the natural logarithm. ||number log(number,base=e) | |[http://www.php.net/manual/en/function.log.php log]|| The logarithm of number to base, if given, or the natural logarithm. ||number log(number,base=e) | ||
Line 98: | Line 100: | ||
|[http://www.php.net/manual/en/function.quotemeta.php quotemeta]||Quote meta characters||string quotemeta(string) | |[http://www.php.net/manual/en/function.quotemeta.php quotemeta]||Quote meta characters||string quotemeta(string) | ||
|- | |- | ||
|[http://www.php.net/manual/en/function.rand.php rand]||Generate a random integer, see [[Expression Manager | |[http://www.php.net/manual/en/function.rand.php rand]||Generate a random integer, see [[Expression Manager sample surveys#Randomly Ask One Question Per Group|this example]]||int rand() OR int rand(min, max) | ||
|- | |- | ||
|regexMatch||compare a string to a [[Using regular expressions|regular expression]]||bool regexMatch(pattern,input) | |regexMatch||compare a string to a [[Using regular expressions|regular expression]]||bool regexMatch(pattern,input) | ||
Line 126: | Line 128: | ||
|[http://www.php.net/manual/en/function.strip-tags.php strip_tags]||Strip HTML and PHP tags from a string||string strip_tags(str, allowable_tags) | |[http://www.php.net/manual/en/function.strip-tags.php strip_tags]||Strip HTML and PHP tags from a string||string strip_tags(str, allowable_tags) | ||
|- | |- | ||
|[http://www.php.net/manual/en/function.stripos.php stripos]||Find position of first occurrence of a case-insensitive string||int stripos(haystack, needle <nowiki>[</nowiki>, offset=0]) | |[http://www.php.net/manual/en/function.stripos.php stripos]||Find position of first occurrence of a case-insensitive unicode string (starting by 0, return false if not found)|||int stripos(haystack, needle <nowiki>[</nowiki>, offset=0]) | ||
|- | |- | ||
|[http://www.php.net/manual/en/function.stripslashes.php stripslashes]||Un-quotes a quoted string||string stripslashes(string) | |[http://www.php.net/manual/en/function.stripslashes.php stripslashes]||Un-quotes a quoted string||string stripslashes(string) | ||
Line 134: | Line 136: | ||
|[http://www.php.net/manual/en/function.strlen.php strlen]||Get string length||int strlen(string) | |[http://www.php.net/manual/en/function.strlen.php strlen]||Get string length||int strlen(string) | ||
|- | |- | ||
|[http://www.php.net/manual/en/function.strpos.php strpos]||Find position of first occurrence of | |[http://www.php.net/manual/en/function.strpos.php strpos]||Find position of first occurrence of an unicode string (starting by 0, return false if not found)||int strpos(haystack, needle <nowiki>[</nowiki> offset=0]) | ||
|- | |- | ||
|[http://www.php.net/manual/en/function.strrev.php strrev]||Reverse a string||string strrev(string) | |[http://www.php.net/manual/en/function.strrev.php strrev]||Reverse a string||string strrev(string) | ||
|- | |- | ||
|[http://www.php.net/manual/en/function.strstr.php strstr]||Find first occurrence of a string||string strstr(haystack, needle) | |[http://www.php.net/manual/en/function.strstr.php strstr]||Find first occurrence of a string||string strstr(haystack, needle<nowiki>[</nowiki>, before_needle=false]) | ||
|- | |- | ||
|[http://www.php.net/manual/en/function.strtolower.php strtolower]||Make a string lowercase||string strtolower(string) | |[http://www.php.net/manual/en/function.strtolower.php strtolower]||Make a string lowercase||string strtolower(string) | ||
Line 146: | Line 148: | ||
|[http://www.php.net/manual/en/function.strtoupper.php strtoupper]||Make a string uppercase||string strtoupper(string) | |[http://www.php.net/manual/en/function.strtoupper.php strtoupper]||Make a string uppercase||string strtoupper(string) | ||
|- | |- | ||
|[http://www.php.net/manual/en/function.substr.php substr]||Return part of | |[http://www.php.net/manual/en/function.substr.php substr]||Return part of an unicode string||string substr(string, start <nowiki>[</nowiki>, length]) | ||
|- | |- | ||
|sum||Calculate the sum of values in an array||number sum(arg1, arg2, ... argN) | |sum||Calculate the sum of values in an array||number sum(arg1, arg2, ... argN) |
Latest revision as of 15:25, 28 November 2020
Function | Meaning | Syntax |
---|---|---|
abs | Absolute value | number abs(number) |
acos | Arc cosine | number acos(number) |
addslashes | Quote string with slashes | string addslashes(string) |
asin | Arc sine | number asin(number) |
atan | Arc tangent | number atan(number) |
atan2 | Arc tangent of two variables | number atan2(number, number) |
ceil | Round fractions up | number ceil(number) |
checkdate | Returns true(1) if it is a valid date in gregorian calendar | bool checkdate(month,day,year) |
convert_value | Convert a numerical value using a inputTable and outputTable of numerical values | number convert_value(fValue, iStrict, sTranslateFromList, sTranslateToList) |
cos | Cosine | number cos(number) |
count | count the number of answered (non-blank) questions in the list | number count(arg1, arg12, ..., argN) |
countif | Count the number of answered questions in the list equal to the first argument | number countif(matches, arg1, arg2, ... argN) |
countifop | Count the number of answered questions in the list which pass the criteria (arg op value) | number countifop(op, value, arg1, arg2, ... argN) |
date | Format a local date/time | string date(format [, timestamp=time()]) |
exp | Calculates the exponent of e | number exp(number) |
fixnum | Display numbers with comma as radix separator, if needed | string fixnum(number) |
floor | Round fractions down | number floor(number) |
gmdate | Format a GMT date/time | string gmdate(format [, timestamp=time()]) |
html_entity_decode | Convert all HTML entities to their applicable characters (always uses ENT_QUOTES and UTF-8) | string html_entity_decode(string) |
htmlentities | Convert all applicable characters to HTML entities (always uses ENT_QUOTES and UTF-8) | string htmlentities(string) |
expr_mgr_htmlspecialchars | Convert special characters to HTML entities (always uses ENT_QUOTES and UTF-8) | string htmlspecialchars(string) |
expr_mgr_htmlspecialchars_decode | Convert special HTML entities back to characters (always uses ENT_QUOTES and UTF-8) | string htmlspecialchars_decode(string) |
idate | Format a local time/date as integer | string idate(string [, timestamp=time()]) |
if (Updated in 3.0.2 ) | Excel-style if(test,result_if_true[,result_if_false = ""]) | if(test,result_if_true[,result_if_false = ""]) |
implode | Join array elements with a string | string implode(glue,arg1,arg2,...,argN) |
intval | Get the integer value of a variable | int intval(number [, base=10]) |
is_empty | Determine whether a variable is considered to be empty | bool is_empty(var) |
is_float | Finds whether the type of a variable is float | bool is_float(var) |
is_int | Find whether the type of a variable is integer | bool is_int(var) |
is_nan | Finds whether a value is not a number | bool is_nan(var) |
is_null | Finds whether a variable is NULL | bool is_null(var) |
is_numeric | Finds whether a variable is a number or a numeric string | bool is_numeric(var) |
is_string | Find whether the type of a variable is string | bool is_string(var) |
join (New in 2.0 build 130129) | Join elements as a new string | join(arg1, arg2, ... argN) |
list | Return comma-separated list of non-blank values | string list(arg1, arg2, ... argN) |
listifop (New in 3.16.1 ) | Return a 'glue'-separated list of the specified question property (retProp) from questions in the list which pass the criteria (cmpProp op value) | string listifop(cmpProp, op, value, retProp, glue, sgqa1, sgqa2, ... sgqaN) |
log | The logarithm of number to base, if given, or the natural logarithm. | number log(number,base=e) |
ltrim | Strip whitespace (or other characters) from the beginning of a string | string ltrim(string [, charlist]) |
max | Find highest value | number max(arg1, arg2, ... argN) |
min | Find lowest value | number min(arg1, arg2, ... argN) |
mktime | Get UNIX timestamp for a date (each of the 6 arguments are optional) | number mktime([hour [, minute [, second [, month [, day [, year ]]]]]]) |
modulo-function | The modulo function is not supported yet. You can use the floor() function instead | floor(x/y)==(x/y) |
nl2br | Inserts HTML line breaks before all newlines in a string | string nl2br(string) |
number_format | Format a number with grouped thousands | string number_format(number) |
pi | Get value of pi | number pi() |
pow | Exponential expression | number pow(base, exp) |
quoted_printable_decode | Convert a quoted-printable string to an 8 bit string | string quoted_printable_decode(string) |
quoted_printable_encode | Convert a 8 bit string to a quoted-printable string | string quoted_printable_encode(string) |
quotemeta | Quote meta characters | string quotemeta(string) |
rand | Generate a random integer, see this example | int rand() OR int rand(min, max) |
regexMatch | compare a string to a regular expression | bool regexMatch(pattern,input) |
round | Rounds a number to an optional precision | number round(val [, precision]) |
rtrim | Strip whitespace (or other characters) from the end of a string | string rtrim(string [, charlist]) |
sin | Sine | number sin(arg) |
sprintf | Return a formatted string | string sprintf(format, arg1, arg2, ... argN) |
sqrt | Square root | number sqrt(arg) |
stddev | Calculate the Sample Standard Deviation for the list of numbers | number stddev(arg1, arg2, ... argN) |
str_pad | Pad a string to a certain length with another string | string str_pad(input, pad_length [, pad_string]) |
str_repeat | Repeat a string | string str_repeat(input, multiplier) |
str_replace | Replace all occurrences of the search string with the replacement string | string str_replace(search, replace, subject) |
strcasecmp | Binary safe case-insensitive string comparison | int strcasecmp(str1, str2) |
strcmp | Binary safe string comparison | int strcmp(str1, str2) |
strip_tags | Strip HTML and PHP tags from a string | string strip_tags(str, allowable_tags) |
stripos | Find position of first occurrence of a case-insensitive unicode string (starting by 0, return false if not found) | int stripos(haystack, needle [, offset=0]) |
stripslashes | Un-quotes a quoted string | string stripslashes(string) |
stristr | Case-insensitive strstr | string stristr(haystack, needle [, before_needle=false]) |
strlen | Get string length | int strlen(string) |
strpos | Find position of first occurrence of an unicode string (starting by 0, return false if not found) | int strpos(haystack, needle [ offset=0]) |
strrev | Reverse a string | string strrev(string) |
strstr | Find first occurrence of a string | string strstr(haystack, needle[, before_needle=false]) |
strtolower | Make a string lowercase | string strtolower(string) |
strtotime | Parse about any English textual datetime description into a Unix timestamp | int strtotime(string) |
strtoupper | Make a string uppercase | string strtoupper(string) |
substr | Return part of an unicode string | string substr(string, start [, length]) |
sum | Calculate the sum of values in an array | number sum(arg1, arg2, ... argN) |
sumifop | Sum the values of answered questions in the list which pass the criteria (arg op value) | number sumifop(op, value, arg1, arg2, ... argN) |
tan | Tangent | number tan(arg) |
time | Return current UNIX timestamp | number time() |
trim | Strip whitespace (or other characters) from the beginning and end of a string | string trim(string [, charlist]) |
ucwords | Uppercase the first character of each word in a string | string ucwords(string) |
unique | Returns true if all non-empty responses are unique | boolean unique(arg1, ..., argN) |