PHP Developer’s Dictionary IT-SC book 170 The ord() function returns the ASCII value of the first character of the string parameter. This function complements chr() . echo ord("ABCDEF");//displays 65 parse_str Syntax void parse_str(string str) Description The parse_str() function processes str as though it were the query string from the page request. This includes setting the variables read into the current scope from str . print() Syntax print(string arg) Description The print() function outputs arg . $avar = "test"; print ($avar);//displays test printf() Syntax int printf(string format , mixed [ args ] ) Description PHP Developer’s Dictionary IT-SC book 171 The printf() function displays args output according to format . The format string is made up of zero or more directives: ordinary characters (excluding % ) that are copied directly into the result, along with conversion specifications, each of which results in fetching its own parameter. Each conversion specification consists of these elements, in order: padding specifieris an optional parameter that specifies which character to use if padding is necessary to adjust the string to a larger size. The default is to pad with spaces, but can also be specified as the 0 (zero character). To specify an alternative padding character, precede the character with a single quote ( ' ). alignment specifier is an optional parameter that indicates whether the resulting string should be right- or left-justified. The default is right- justified, and a "-" character is used to indicate left justification. width specifier is an optional number that specifies the minimum number of characters the result should contain. precision specifier is an optional parameter that specifies the number of decimal digits that should be displayed for floating-point numbers. This applies only to numbers of type double. type specifier specifies the type as which the argument should be treated. Possible types as which the argument can be treated are %— Treat as a percent character. No argument is required. b— Treat as an integer and present as a binary number. c— Treat as an integer and present as the character with the corresponding ASCII value. d— Treat as an integer and present as a decimal number. f— Treat as a double and present as a floating-point number. o— Treat as an integer and present as an octal number. s— Treat and present as a string. x— Treat as an integer and present as a hexadecimal number (with lowercase letters). X— Treat as an integer and present as a hexadecimal number (with uppercase letters). $type = "checking"; $balance = 500; PHP Developer’s Dictionary IT-SC book 172 printf("type = %s, balance = %2.2f",$type,$balance); //displays type = checking, balance= 500.00 quoted_printable_decode() Syntax string quoted_printable_decode(string str) Description The quoted_printable_decode() function, which was added in PHP 3.0.6 and PHP 4.0, returns an 8-bit binary string that corresponds to the decoded quoted printable str . This function is similar to imap_qprint() except that the IMAP module is not required for this function to work. quotemeta() Syntax string quotemeta(string str) Description The quotemeta() function returns a version of str with a backslash character ( \ ) before every character that is among these . \\ \\ + * ? [ ^ ] ( $ ). rawurldecode() Syntax string rawurldecode(string str) Description PHP Developer’s Dictionary IT-SC book 173 The rawurldecode() function returns str in which any % followed by two hex digit codes are replaced with the literal characters. This is often used to decode URL information that has special characters in it passed in from a browser. rawurlencode() Syntax string rawurlencode(string str) Description The rawurlencode() function returns a string in which all nonalphanumeric characters except '-' , '_' , and '.' in str have been replaced with a percent ( % ) sign followed by two hex digits. The encoding process is detailed in RFC 1738. The purpose of this function is to preserve characters so that they are not interpreted as special URL delimiters. setlocale() Syntax string setlocale(string category, string locale) Description The setlocale() function indicates the locale that functions in the category should use. The category parameter has the following possible options: LC_ALL for everything listed in the following options. LC_COLLATE for string comparison. This is not currently implemented in PHP. LC_CTYPE for character classification and conversion such as s trtolower() , ucfirst() , and strtoupper() . LC_MONETARY for localeconv()— not currently implemented in PHP. LC_NUMERIC for decimal separator. LC_TIME for date and time formatting with strftime() . similar_text() PHP Developer’s Dictionary IT-SC book 174 Syntax int similar_text(string first, string second, [double percent]) Description The similar_text() function, which was added in PHP 3.0.7 and PHP 4.0b24, describes the similarity of the first and second strings. The similarity is based on an algorithm proposed by Oliver in 1993. Also note that the complexity of this algorithm is O(N**3) where N is the length of the longest string. By passing a reference as a third argument, similar_text() will calculate the similarity in percent for you. It returns the number of matching characters in both strings. echo similar_text("abcdefg","bbcdefh");//displays 5 soundex() Syntax string soundex(string str ) Description The soundex() function returns a key that represents how the string is pronounced. This is useful in searching for a word when the correct spelling is not known. This soundex() function returns a string four characters long, starting with a letter. This soundex() function is described by Donald Knuth in The Art of Computer Programming, Vol. 3: Sorting and Searching , Addison-Wesley (1973), pp. 391–392. echo soundex("their");//displays T600 echo soundex("there");//displays T600 echo soundex("root");//displays R300 echo soundex("route");//displays R300 echo soundex("wrote");//displays W630 sprintf() Syntax string sprintf(string format, mixed [args] ) . quoted_printable_decode(string str) Description The quoted_printable_decode() function, which was added in PHP 3.0.6 and PHP 4.0, returns an 8-bit binary string that corresponds to the decoded quoted printable. implemented in PHP. LC_CTYPE for character classification and conversion such as s trtolower() , ucfirst() , and strtoupper() . LC_MONETARY for localeconv()— not currently implemented in PHP. . similar_text() PHP Developer’s Dictionary IT-SC book 174 Syntax int similar_text(string first, string second, [double percent]) Description The similar_text() function, which was added in PHP