Archive for May, 2009
Magic Quotes
Deprecated in PHP 5.3 and to be removed as of PHP 6.0. Whatever version you’re using, turn it off and write your code to work with it off.
addslashes()
Places a backslash before quote characters, backslashes, and the nul-byte character. If considering this for use with a database, look for a database specific function first.
stripslashes()
Un-quotes a quoted string. Typically done by removing backslashes but if magic_quotes_sybase is on, any pair of single quotes will be replaced by one single quote instead.
strip_tags()
Attempts to remove all HTML tags and comments. You may specify a list of allowed tags for it not to remove.
number_format()
Formats a number (float) to use a decimal separator and thousands separator. You also specify how many decimal places to use. Default is two decimal places using . and thousands separated by a comma.
print
Outputs a string and always returns 1.
echo
Outputs a string, or more than one string. It can take multiple arguments.
chunk_split()
Inserts a string into another string every so many characters. Defaults to instering “\r\n” every 76 characters.
str_split()
Create an array from characters in a string. Specify how many characters will form an array element or use the default of one.
substr_replace()
Replaces a portion of a string with another string. You specify the start position and how many characters to replace.
