FUNCTION NAME |
FUNCTION DESCRIPTION |
FUNCTION SYNTAX |
FUNCTION RETURN VALUE |
htmlspecialchars()
[Convert special characters to HTML entities] |
This function returns a string with certain characters – that have a special meaning in HTML – converted to entities. The following characters will be translated: ampersand; double quote; single quote; ‘less than’ sign; and the ‘greater than’ sign. |
htmlspecialchars(string, flags [optional parameter, default value of ENT_COMPAT|ENT_HTML401], encoding [optional parameter, default value of ini_get(“default_charset”)], double_encode [optional parameter, default value of TRUE]); |
htmlspecialchars() : returns the converted string. An empty string will be returned if string contains an invalid code unit sequence within the given encoding, unless either the ENT_IGNORE or ENT_SUBSTITUTE flags are set. |
implode()
[Join array elements with a string] |
This function condenses [‘implodes’] pieces_array into a string, compressing the array elements with glue_string. glue_string defaults to an empty string. This function is an alias of join() . |
implode(glue_string [optional parameter, with a default value of an empty string], pieces_array); |
implode() : returns a string containing a string representation of the imploded array, with glue_string between each element. |
lcfirst()
[Make a string’s first character lowercase] |
Returns a string with the first character of string lowercased if that character is ‘alphabetic’. ‘Alphabetic’ is determined with reference to the current locale; in the default ‘C’ locale, characters such as umlaut-a will not be converted. |
lcfirst(string); |
lcfirst() : returns string with its first character lowercased if the character is deemed ‘alphabetic’; otherwise it returns the input string. |
levenshtein()
[Calculate Levenshtein distance between two strings] |
The Levenshtein distance is defined as the minimum number of characters you have to replace, insert, or delete to transform string_1 into string_2. The simplest form of the function just calculates the number of replace, insert, or delete operations needed to transform string_1 into string_2. A more general and adaptive – but less efficient – variant takes three extra parameters that define the cost of replace, insert, and delete operations. |
Variant One:
levenshtein(string_1, string_2);
Variant Two:
levenshtein(string_1, string_2, insert_cost, replace_cost, delete_cost);
|
levenshtein() : returns the Levenshtein-Distance between string_1 and string_2 OR -1 if one of the strings is longer than 255 characters. |
localeconv()
[Get numeric formatting information] |
Returns an associative array containing localized numeric and monetary formatting information. Returns data based on the current locale as defined by setlocale() . |
localeconv(); |
localeconv() : returns an associative array containing locale-specific numeric formatting information. Elements comprise: ‘decimal_point’; ‘thousands_sep’; ‘grouping’; ‘int_curr_symbol’; ‘currency_symbol’; ‘mon_decimal_point’; ‘mon_thousands_sep’; ‘mon_grouping’; ‘positive_sign’; ‘negative_sign’; ‘int_frac_digits’; ‘frac_digits’; ‘p_cs_precedes’; ‘p_sep_by_space’; ‘n_cs_precedes’; ‘n_sep_by_space’; ‘p_sign_posn’; and ‘n_sign_posn’. |
ltrim()
[Strip whitespace (or other characters) from the beginning of a string] |
This function strips (‘trims’) whitespace (or other characters) from the beginning (left-hand side) of string. |
ltrim(string, character_mask [optional parameter – simply list all the characters you want stripped; using ‘..’ defines a range]); |
ltrim() : returns a string with whitespace (and any other characters specified in character_mask) trimmed from the start of string.
If no further characters are specified in the character_mask parameter, ltrim() will strip the following characters: an ordinary space; a tab; a newline; a carriage return; the NUL-byte; and a vertical tab. |
md5_file()
[Calculates the md5 hash of a given file] |
Calculates the MD5 hash of the specified file, using the RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash [a 32-character hexadecimal number]. |
md5_file(file, raw_output [optional parameter, with a default value of FALSE]);
[When raw_output is TRUE, the digest is returned in raw binary format with a length of 16.] |
md5_file() : returns a string on success; FALSE otherwise. |
md5()
[Calculate the md5 hash of a string] |
Calculates the MD5 hash of string, using the RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash. Owing to the fast nature of the hashing algorithm, it is not recommended to use this function to secure passwords. |
md5(string, raw_output
[optional parameter, with a default value of FALSE]);
[If raw_output is set to TRUE, the md5 digest is returned in raw binary format with a length of 16.] |
md5() : returns the MD5 hash of string. |
metaphone()
[Calculate the metaphone key of a string] |
Calculates the metaphone key of string. Similar to soundex() , but more accurate since it knows the basic rules of English pronunciation. The metaphone-generated keys are of variable length. |
metaphone(string, phonemes [optional parameter, defaulting to 0 – meaning ‘no restriction’]); |
metaphone() : returns the metaphone key as a string on success; FALSE on failure. |
money_format()
[Formats a number as a currency string] |
This function returns a monetarily–formatted version of number. It wraps the C library function strfmon() , with the difference that this function converts only one number at a time; this function is only defined on systems that implement strfmon capabilities. |
money_format(format, number);
[The format sequence is as follows: a percentage character — optional flags — optional field width — optional left precision — optional right precision — a required conversion character.] |
money_format() : returns the monetarily–formatted string. Characters preceding and succeeding the format string will be returned unchanged. A non-numeric number causes NULL to be returned and an E_WARNING to be emitted. |
nl_langinfo()
[Query language and locale information] |
nl_langinfo() is used to access individual elements of the locale categories; it allows you to select any specific element. |
nl_langinfo(item);
[item may be an integer value of the element or the constant name of the element. The following constant names can be used: ABDAY_(1-7); DAY_(1-7); ABMON_(1-12); MON_(1-12); AM_STR; PM_STR; D_T_FMT; D_FMT; T_FMT; T_FMT_AMPM; ERA; ERA_YEAR; ERA_D_T_FMT; ERA_D_FMT; ERA_T_FMT; INT_CURR_SYMBOL; CURRENCY_SYMBOL; CRNCYSTR; MON_DECIMAL_POINT; MON_THOUSANDS_SEP; MON_GROUPING; POSITIVE_SIGN; NEGATIVE_SIGN; INT_FRAC_DIGITS; FRAC_DIGITS; P_CS_PRECEDES; P_SEP_BY_SPACE; N_CS_PRECEDES; N_SEP_BY_SPACE; P_SIGN_POSN; N_SIGN_POSN; DECIMAL_POINT; RADIXCHAR; THOUSANDS_SEP; THOUSEP; GROUPING; YESEXPR; NOEXPR; YESSTR; NOSTR; or CODESET.] |
nl_langinfo() : returns the element as a string; FALSE on failure. |