Webmaster
| |
| base64_decode(data) | |
| Decodes data encoded with MIME base64, for instance, when binary files are sent through e-mail. | |
| Example | <? $file = "YUVf8djrYEkd45dhe7lLe78qa5etTAre7PrT1KFcF4"; base64_decode($file); ?> |
| base64_encode(string) | |
| Returns data encoded with base64, for instance, when binary files need to be sent through e-mail. | |
| Example | <? $string = "Here is a message\n"; base64_encode($string); ?> |
| basename(path) | |
| Returns the filename part of a string containing a whole path to a file. | |
| Example | <? $path="/doc/users/dino/liste.asc"; print(basename($path)); ?> |
| chop(string) | |
| Returns the string passed as the argument with white spaces stripped from the end. | |
| Example | <? print("\"" .chop("A sentence with a lot of trailing white spaces ")."\""); ?> |
| chr(ASCII_code) | |
| Returns the character corresponding to the ASCII code passed as the argument. | |
| Example | <? print(chr(28)); ?> |
| dirname(path) | |
| Returns the directory portion of a filename qualified by a path. | |
| Example | <? $path = "/doc/users/dino/liste.asc"; dirname($path); ?> |
| htmlentities(string) | |
| Translates all the characters that have HTML character entity equivalents into these entities. Here are the character entity references recognised by this function: aacute, acirc, acute, aelig, agrave, amp, aring, atilde, auml, brvbar, ccedil, cedil, cent, copy, curren, deg, divide, eacute, ecirc, egrave, eth, euml, frac12, frac14, frac34, gt, iacute, icirc, iexcl, igrave, iquest, iuml, laquo, lt, macr, micro, middot, nbsp, not, ntilde, oacute, ocirc, ograve, ordf, ordm, oslash, otilde, ouml, para, plusmn, pound, quot, raquo, reg, sect, shy, sup1, sup2, sup3, szlig, thorn, times, uacute, ucirc, ugrave, uml, uuml, yacute, yen, yuml. | |
| Example | <? $var = "Not all keyboards have the é and ŕ keys."; htmlentities($var); ?> |
| htmlspecialchars(string) | |
| Similar to htmlentities but for a more limited set of characters. | |
| ltrim(string) | |
| Strips all white spaces from the beginning of a string. | |
| Example | <? $var = " A sentence beginning with white spaces."; ltrim($var); ?> |
| newline_to_br(string) | |
| Returns the string passed as the argument with new line characters replaced by the BR HTML element. If this function does not exist in your version of PHP, use the nl2br() alias. | |
| Example | <? $var = "line1\nline2\n"; print(newline_to_br($var)); ?> |
| nl2br(string) | |
| Similar to the newline_to_br function. | |
| ord(string) | |
| Returns the ASCII value of the first character appearing in the argument. | |
| Example | <? print(ord("m")); ?> |
| parse_url(URL) | |
| This function parses the URL passed as the argument and returns its components in an associative array. Here are the main elements returned: scheme, host, path et query. | |
| Example | <? $query = "http://www.mysite.com"; $query .= "/folder/analyse.php3?"; $query .= "name=henry&work=London+Engineer"; $url = parse_url($query); ?> |
| quotemeta(string) | |
| Returns the string passed as the argument after adding a backslash character before each of the following special characters: ., \, +, *, ?, [, ], ^, (, ), $. | |
| Example | <? $command = "echo 'Hello, how are you?'"; quotemeta($command); ?> |
| rawurldecode(URL) | |
| Returns the URL passed as the argument after replacing the sequences of the percentage sign followed by two hexadecimal digits by their corresponding literal characters. | |
| Example | <? print(rawurldecode("mailto:peter%40mysite.com")); ?> |
| rawurlencode(URL) | |
| Returns the string passed as the argument after replacing all special characters with their corresponding hexadecimal value prefixed with a percentage sign. | |
| Example | <? rawurlencode("mailto:peter@mysite.com"); ?> |
| stripslashes(string) | |
| Returns the argument with all the backslashes stripped from the escaped characters. | |
| Example | <? print(stripslashes("The \'head\' HTML element")); ?> |
| strrev(string) | |
| Returns a string after reversing its characters. | |
| Example | <? print(strrev("abcdefg")); ?> |
| strtolower(string) | |
| Returns the string passed as the argument with all the alphabetical characters converted into lowercase letters. | |
| Example | <? print(strtolower("I Took 5 Kilos")); ?> |
| strtoupper(string) | |
| Returns the string with all the alphabetical characters converted into uppercase letters. | |
| Example | <? print(strtoupper("I took 5 kilos")); ?> |
| strtr(string, string_from, string_to) | |
| Returns the string argument after replacing the characters listed in string_from by the corresponding characters in string_to. | |
| Example | <? $string = "Oops! I see."; $string_from = "!."; $string_to = "?!"; print(strtr($string, $string_from, $string_to)); ?> |
| trim(string) | |
| Strips all the beginning and trailing white spaces from the string. This is very useful for cleaning data collected from a form before inserting them in a database. | |
| Example | <? $var = " data "; trim($var); ?> |
| ucfirst(string) | |
| Converts the first character of the argument into the upper case. | |
| Example | <? print(ucfirst("paris is the capital of France.")); ?> |
| ucwords(string) | |
| Converts the first letter of each word in the string into the upper case. | |
| Example | <? print(ucwords("paris is the capital of france.")); ?> |
| urldecode(URL) | |
| Returns an URL-encoded string after decoding all the percentage signs followed by two hexadecimal digits. | |
| Example | <? print(urldecode("mailto:peter%40mysite.com")); ?> |
| urlencode(URL) | |
| Returns the URL passed as the argument after replacing all non-alphabetical characters by a percentage sign followed by two hexadecimal digits and space characters by a plus sign. | |
| Example | <? print(urlencode("peter@mysite.com")); ?> |
| |