FUNCTION NAME |
FUNCTION DESCRIPTION |
FUNCTION SYNTAX |
FUNCTION RETURN VALUE |
crypt()
[One-way string hashing] |
crypt() will return a hashed string using the standard Unix DES-based algorithm or alternative algorithms that may be available on the system. Although salt is optional, crypt() creates a weak hash without it. PHP 5.6+ raises an E_NOTICE error without salt. password_hash() – a simple crypt wrapper – uses a strong hash, generates a strong salt, and applies proper rounds automatically; its use is encouraged. |
crypt(string, salt [optional parameter]); |
crypt() : returns the hashed string on success or a string that is shorter than 13 characters and is guaranteed to differ from the salt on FAILURE.
When validating passwords, a string comparison function that isn’t vulnerable to timing attacks should be used to compare the output of crypt() to the previously-known hash — PHP 5.6+ provides hash_equals() for this purpose. |
echo()
[Output one or more strings] |
Outputs [‘echoes’] all parameters; no newline is appended. If you want to pass more than one parameter to echo() , the parameters must not be enclosed within parentheses. Unlike print , echo() accepts an argument list and has no return value. |
Standard Syntax:
echo(string_1, string_2 …[optional parameter]);
Shortcut Syntax [since PHP 5.4.0 / any PHP version with short_open_tag enabled]:
<?=$string?> |
echo() : No value is returned. |
explode()
[Split a string by a string] |
Returns an array of strings, each of which is a substring of string created by splitting (‘exploding’) it on boundaries formed by the string delimiter. |
explode(delimiter, string, limit [optional parameter with a default value of PHP_INT_MAX ] );
[If limit is positive, the returned array will contain a maximum of limit elements – with the last element containing the rest of string. If limit is negative, the returned array contains all but –limit components. If the limit parameter is 0, this is treated as 1.] |
explode() : returns an array of strings created by splitting [‘exploding’] string by the boundaries formed by delimiter. explode() will return FALSE if delimiter is an empty string. If delimiter represents a value that is not contained in string AND a negative limit is used, this function returns an empty array; otherwise, an array containing string will be returned. |
fprintf()
[Write a formatted string to a stream] |
This function writes a string produced according to format to the stream resource specified by handle. |
fprintf(resource_handle, format, args [optional parameter – arguments can be passed to this function]); |
fprintf() : returns the number of bytes written to the resource stream. |
get_html_translation_table()
[Returns the translation table used by htmlspecialchars() and htmlentities() ] |
Returns the translation table that is used internally for htmlspecialchars and htmlentities. |
get_html_translation_table(table [optional parameter, default is HTML_SPECIALCHARS], flags [optional parameter, default is ENT_COMPAT|ENT_HTML401], encoding [optional parameter, default is “UTF_8” in PHP 5.4.0+; was ISO-8859-1 prior to PHP 5.4.0]);
[table can be either HTML_ENTITIES or HTML_SPECIALCHARS.
flags specifies the type of quotes that the table will contain, as well as which document type the table is for: ENT_COMPAT [contains double quote entity, not single quote]; ENT_QUOTES [contains both double and single quote entities]; ENT_NOQUOTES [contains neither double nor single quote entities]; ENT_HTML401 [table for HTML 4.01]; ENT_XML1 [table for XML 1]; ENT_XHTML [table for XHTML]; ENT_HTML5 [table for HTML 5].
encoding can be one of the following strings: “ISO-8859-1”; “ISO-8859-5”; “UTF-8”; “cp866”; “cp1251”; “cp1252”; “KOI8-R”; “BIG5”; “GB2312”; “BIG5-HKSCS”; “Shift-JIS”; “EUC-JP”; “MacRoman”; OR an empty string. An empty string triggers sequential detection from script encoding, default_charset() , and current locale. Its use is not recommended. If an unrecognized charset is passed to the function, a warning will be emitted and the default encoding will be used instead.] |
get_html_translation_table() : returns the translation table as an array, with the original characters as keys and the entities as values. |
hebrev()
[Convert logical hebrew text to visual text] |
This function tries to avoid breaking words while converting logical hebrew_text to visual text. |
hebrev(hebrew_text, max_chars_per_line [optional parameter, default of 0]); |
hebrev() : returns the visual string conversion of hebrew_text. |
hebrevc()
[Convert logical hebrew text to visual text with newline conversion] |
This function tries to avoid breaking words while converting logical hebrew_text to visual text and converting newlines (\n ) to <br/>\n . |
hebrevc(hebrew_text, max_chars_per_line [optional parameter, default of 0]); |
hebrevc() : returns the visual string conversion of hebrew_text. |
hex2bin()
[Decodes a hexadecimally-encoded binary string] |
This function decodes a hexadecimally-encoded binary string.
It does NOT convert a hexadecimal number to a binary number – this can be done using base_convert() . |
hex2bin(data_string); |
hex2bin() : returns the binary representation of data_string on success; FALSE on failure. If data_string is of an odd length or is an invalid hexadecimal string, an E_WARNING-level error is thrown. |
html_entity_decode()
[Convert HTML entities to their corresponding characters] |
Insofar as it decodes HTML entities in string to their corresponding characters, this function achieves the opposite of htmlentities() . This function decodes all the entities that are necessarily valid for the chosen document type and whose character(s) are in the coded character set associated with the chosen encoding and are permitted in the chosen document type; all other entities are left as-is. |
html_entity_decode(string, flags [optional parameter, default = ENT_COMPAT|ENT_HTML401], encoding [optional parameter, default = ini_get("default_charset") ; was ISO-8859-1 previously]);
[for more information about flags and encoding, see the get_html_translation_table() function above.] |
html_entity_decode() : returns the decoded string. |
htmlentities()
[Convert all applicable characters to HTML entities] |
This function provides the same functionality as htmlspecialchars() , as well as translating all characters that have HTML character entity equivalents into those entities. |
htmlentities(string, flags [optional parameter, default value of ENT_COMPAT|ENT_HTML401], encoding [optional parameter, default value of ini_get(“default_charset”) in PHP 5.6+; PHP 5.4, PHP 5.5 default = UTF-8; default of earlier versions was ISO-8859-1], double_encode [optional parameter, default value of TRUE]);
[For more information about encoding see the get_html_translation_table() function above.
flags can be any of the following constants: ENT_COMPAT; ENT_QUOTES; ENT_NOQUOTES; ENT_IGNORE; ENT_SUBSTITUTE; ENT_DISALLOWED; ENT_HTML401; ENT_XML1; ENT_XHTML; or ENT_HTML5.] |
htmlentities() : returns the encoded string on success. If string contains an invalid code unit sequence an empty string will be returned unless either the ENT_IGNORE or ENT_SUBSTITUTE flags are set. |
htmlspecialchars_decode()
[Convert special HTML entities back to characters] |
This function converts HTML entities back to characters; it does the opposite of the htmlspecialchars() function. The following entities are decoded: ampersand; double quote (when ENT_NOQUOTES is not set); single quote (when ENT_QUOTES is set); ‘less than’ sign; and the ‘greater than’ sign. |
htmlspecialchars_decode(string, flags [optional parameter, default value is ENT_COMPAT|ENT_HTML401]);
[The flags parameter can be any of the following values: ENT_COMPAT; ENT_QUOTES; ENT_NOQUOTES; ENT_HTML401; ENT_XML1; ENT_XHTML; or ENT_HTML5.] |
htmlspecialchars_decode() : returns the decoded string. |