PHP Developer''''s Dictionary- P34 pot

5 234 0
PHP Developer''''s Dictionary- P34 pot

Đang tải... (xem toàn văn)

Thông tin tài liệu

PHP Developer’s Dictionary IT-SC book 165 Description The htmlentities() function returns a version of string in which any reserved HTML characters have been translated into "safe" strings. The characters most often encountered are '&' (ampersand) becomes '&amp;' '"' (double quote) becomes '&quot;' '<' (less than) becomes '&lt;' '>' (greater than) becomes '&gt;' However, htmlentities() also translates other characters which have an HTML equivalent. Currently, the translations are based on the ISO-8859-1 character set. This function is often used to preserve text input by a user that will be displayed in a Web page. htmlspecialchars() Syntax string htmlspecialchars(string string) Description The htmlspecialchars() function returns a version of string in which any reserved HTML characters have been translated into "safe" strings. The characters translated by htmlspecialchars() are '&' (ampersand) becomes '&amp;' '"' (double quote) becomes '&quot;' '<' (less than) becomes '&lt;' '>' (greater than) becomes '&gt;' implode() Syntax string implode(string glue, array pieces) PHP Developer’s Dictionary IT-SC book 166 Description The implode() function returns a string containing all the pieces elements in the same order, with the glue parameter between each element. $array1 = array (1,2,3); echo implode (",",$array1);//results in "1,2,3" join() Syntax string join(string glue, array pieces) Description The join() function returns a string containing all the pieces elements in the same order, with the glue parameter between each element. The join() function is an alias to implode() and therefore exhibits identical behavior. levenshtein() Syntax int levenshtein (string str1, string str2) Description The levenshtein() function, which was added in PHP 4.0.1, calculates the Levenshtein distance between the two given strings. Note that the strings must be less than 255 characters in length or a –1 will be returned. The distance is defined as the minimum number of characters you have to replace, insert, or delete to transform one string to the other. The complexity of the algorithm is o(m*n) , which is rather expensive. ltrim() Syntax PHP Developer’s Dictionary IT-SC book 167 string ltrim(string str) Description The ltrim() function returns a string that is str with all the leading whitespace removed. Whitespace includes the following characters: "\\ n", "\\ r", "\\ t", "\\ v" , "\\ 0" , and a plain space. md5() Syntax string md5(string str) Description The md5() function calculates the MD5 hash of the str string parameter using the RSA Data Security, Inc. MD5 Message-Digest Algorithm. For more information, see http://www.faqs.org/rfcs/rfc1321.html . echo md5("PHP Dictionary");//displays 522ac575de5b5d3ee2227b9b5e621b7d metaphone() Syntax string metaphone(string str) Description The metaphone() function, which was added in PHP 4.0b4, creates the same key for words that sound similar. Its accuracy is greater than soundex() because it knows the basic rules of English pronunciation. The resulting keys are of variable length. Lawrence Philips ( lphilips@verity.com ) developed metaphone() . For more information, consult Practical Algorithms for Programmers, Binstock & Rex, Addison Wesley, 1995. echo metaphone("root");//displays RT echo metaphone("route");//displays RT echo metaphone("wrote");//displays RT PHP Developer’s Dictionary IT-SC book 168 nl2br() Syntax string nl2br(string string) Description The nl2br() function returns a string comprised of string with <BR> inserted before all new lines. ob_start() Syntax void ob_start(void) Description The ob_start() function, which was added in PHP 4, turns on output buffering. This causes all output to be appended to an internal buffer. Use ob_get_contents() to access this buffer. ob_get_contents() Syntax string ob_get_contents(void) Description The ob_get_contents() function, which was added in PHP 4, returns the contents of the output buffer or false if buffering is not active. ob_end_flush() Syntax PHP Developer’s Dictionary IT-SC book 169 void ob_end_flush(void) Description The ob_end_flush() function, which was added in PHP 4, sends the output buffer to the client and deactivates output buffering. ob_end_clean() Syntax void ob_end_clean(void) Description The ob_end_clean() function, which was added in PHP 4, erases the output buffer and turns off buffering. ob_implicit_flush() Syntax void ob_implicit_flush([int flag]) Description The ob_implicit_flush() function, which was added in PHP 4.0b4, turns on and off output buffering, depending on the flag value. The default is on, which results in a flush operation after every output call. ord() Syntax int ord(string string) Description . md5(" ;PHP Dictionary");//displays 522ac575de5b5d3ee2227b9b5e621b7d metaphone() Syntax string metaphone(string str) Description The metaphone() function, which was added in PHP. ob_get_contents() function, which was added in PHP 4, returns the contents of the output buffer or false if buffering is not active. ob_end_flush() Syntax PHP Developer’s Dictionary IT-SC book. levenshtein (string str1, string str2) Description The levenshtein() function, which was added in PHP 4.0.1, calculates the Levenshtein distance between the two given strings. Note that the strings

Ngày đăng: 07/07/2014, 05:20

Mục lục

  • PHP Developer's Dictionary

  • Acknowledgments

    • Tell Us What You Think!

    • Introduction

      • Who Should Buy This Book?

      • Organization of the Chapters

      • Chapter 1. Basic PHP Background and History

        • Advantages of PHP 4

        • Installation

          • PHP Installation General Overview

          • Types, Variables, and Constants

          • Operators and Mathematical Functions

            • Expressions and Operators

            • Functions, Classes, and Objects

              • Functions

              • Chapter 2. Generating HTML

                • Generating Dynamic Content

                  • Defining Dynamic Content

                  • Using Request Variables to Generate Content

                  • Using the Environment to Generate Content

                  • Working with the Filesystem

                    • Directory Functions

                    • Working with Email

                      • Email Overview

                      • Calendar and Date Functions

                        • Overview of Time and Date Functions

                        • Chapter 3. Database Access

                          • Working with Connections and Data Sources

                            • Setting Up the Database

                            • Using PostgreSQL and PHP

                              • PostgreSQL Overview

                              • Connecting Postgres and PHP

                              • Select, Insert, Update, and Delete Queries

                                • Insert Queries

                                • Select Queries with PHP

Tài liệu cùng người dùng

Tài liệu liên quan