PHP Developer''''s Dictionary- P3 pot

5 394 0
PHP Developer''''s Dictionary- P3 pot

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

Thông tin tài liệu

PHP Developer’s Dictionary IT-SC book 10 He has designed many Web pages, the bulk of them using PHP and ColdFusion to generate content dynamically. Much of his formal development experience was gained on the job working for Developer Support at Novell, Inc. There he was able to learn the intricacies of the C and C++ programming languages as well as to gain valuable networking experience. Acknowledgments R. Allen Wyke First, I would like to thank Bob Kern of TIPS Technical Publishing—yet another project complete, my friend! I would also like to thank my co-authors, Mike and Rob, who helped push me hard to make this the best possible reference out there on PHP. I would also like to thank Shelley Johnston, who has been one of the most wonderful Acquisition Editors I have ever worked with, and Scott Meyers, who is one of the hardest-working Development Editors I have seen. In addition, I would like to thank the rest of the Sams team for making this book a success. Finally, I would like to thank the woman in my life, J, who puts up with my crazy schedule and personality when working on these projects. She has truly been a gift and the most wonderful thing that has ever happened to me. Michael J. Walker I would also like to thank all the people Allen mentioned earlier who helped this book come together and become an invaluable desktop reference. In addition, I thank all my Engage co-workers for the assistance, respect, and camaraderie they have given me. Finally, to my wife Kendra, I thank you for your endless support in all my career and personal endeavors. I could not ask for more. Robert Cox Thanks to Allen, Mike, Bob Kern, and the Sams publishing team for this opportunity to write a book on a subject that I am excited about and find fascinating. Thanks to my beautiful wife and friend, Sheila, for her support. Honey, you put up with a lot. I love you. You're the best! Finally, thanks to my parents for the vision to always push to accomplish goals. You taught me to reach stretch and work to be my best. I have many friends, co-workers, teachers, and mentors who have, by proxy, contributed to this book. It might not be through the printed word or through direct contribution, but your inspiration, dedication, and enthusiasm have molded me into what I am and have given me a vision of what I want to become. Thanks to you all, and God bless. Tell Us What You Think! As the reader of this book, you are our most important critic and commentator. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way. You can email or write me directly to let me know what you did or didn't like about this book—as well as what we can do to make our books stronger. Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message. PHP Developer’s Dictionary IT-SC book 11 When you write, please be sure to include this book's title and author as well as your name and phone or fax number. I will carefully review your comments and share them with the author and editors who worked on the book. Fax: 317-581-4770 E-mail: webdev_sams@mcp.com Mail: Mark Taber Associate Publisher Sams Publishing 201 West 103rd Street Indianapolis, IN 46290 USA PHP Developer’s Dictionary IT-SC book 12 Introduction Welcome to the PHP Developer's Dictionary . We hope that you will find this book the most useful PHP reference available today. This is truly the type of book that should be open next to your workstation, except for those of you who have obtained expert PHP programming status. Even the best of us need to double-check code syntax every once in awhile. Within the pages of this book you will find a quick introduction to the language and a complete reference to the PHP4 language. As a developer, you might often find yourself scrambling for the correct syntax for a function or maybe some clarification on how something works, and this book intends to fill that void. Who Should Buy This Book? Because this is a developer's dictionary, you will not find an in-depth tutorial on the PHP language or complete project code for an application. What you will find is a starter introduction to the language and a complete reference. Because of this, the book is targeted to current PHP developers—developers who need a complete reference of the newest version of the PHP language to keep with them as they program. Organization of the Chapters The book is broken into two primary sections. The first, Chapters 1–3, is a brief introduction to the language, and the remaining ten chapters act as a reference. For those of you who have been programming in PHP for only a short while, you will find that the first section gives you a good understanding of what can be accomplished with PHP and how you might go about it. The rest of you will find an introduction to many topics that you might not have known fall within the PHP domain. This portion of the book will get your mind thinking about how you can exploit these powerful concepts in today's applications. The second section of the book is pure reference. We have tried to group all the PHP functions and language elements in an easy-to-understand and easy-to-access way, for you, the developer. Because the PHP language is always growing and adding new functions, we also tried to organize it in a manner similar to the official documentation so that you can quickly check online for any new additions, comments, or bug reports. Writing Conventions Like all books, we have used a few writing conventions. These are items that you will see throughout the book, and understanding what they mean will better help you use the book. These conventions are as follows: • Inline Syntax— Because this is a book about a programming language, there will be times that we reference language elements or functions in the body of a paragraph. We have used a special monospaced font to signify that these are part of the PHP language. Here is an example: PHP Developer’s Dictionary IT-SC book 13 "You can use the phpinfo() function to…" • Italics— Within a programming book, there are also instances where we need to specify parameters or variables. These are not language elements, but placeholders for where you will plug in the appropriate values. For this, we will put the placeholder in an italic monospaced font. For instance, we might say "The header() function takes a header_directive as its only argument, which…" • Notes, Tips, Warnings— There are many times that we need to give you more information or advice on a topic, but it doesn't really warrant an entire paragraph. So, you will find Notes, Tips, and Warnings interlaced within the chapters to give you a heads up on problem areas, or maybe a URL for an online resource. In addition to these structural elements of the book, you will see other conventions used in the reference section. Primarily based around the organization of the entries, and to help ensure that you get what you need out of the reference, the entries will have the following: • Entry Name— Each entry in the book will begin with the entry's name. These are organized by topic, subtopic, and then alphabetical. Because the PHP programming language is so rich, there are instances of sub-subtopics, but this should be fairly self-explanatory. • Syntax— After the entry's name you will see a brief syntax definition. This will include the actual syntax that should be used when calling the function, as well as the return type of the function. If there are any parameters passed, the definition will point out the data types of the parameters. • Description— The final element in each entry is a description of what it does. Within this area we will provide more information about the parameters, let you know if the element is new to version 4 of PHP, and provide short code examples when needed. And that is all we are going to say. Like yourself, we are developers and small talk does nothing but consume time. We appreciate that you took the time to read the Introduction, and now we will return the favor by wishing you well on your use of the PHP Developer's Dictionary. R. Allen Wyke Michael J. Walker Robert Cox PHP Developer’s Dictionary IT-SC book 14 Chapter 1. Basic PHP Background and History In 1994, Rasmus Lerdorf created the predecessor to what has evolved into one of the fastest-growing server-side scripting languages. PHP started as a set of tools that Rasmus used to track users on his personal Web page. In the spring of 1995, Personal Home Page Tools version 1 was introduced. It contained limited server- side–parsed macros and simple utilities such as a guest book and a hit counter. Later that same year, the parser engine was completely rewritten and released as PHP/FI version 2. This version contained a form interpreter and native mSQL database support. In 1997, PHP took a huge step forward. The parser was completely rewritten by a team of developers led by Zeev Suraski and Andi Gutmans. This parser formed the foundation for version 3 of PHP. The success of PHP is difficult to gauge, but it has been estimated that there are more than 1 million Web sites using PHP and that number is increasing every month. PHP user groups have sprung up all over the globe, many of them swearing allegiance to PHP and predicting the demise of Microsoft's Active Server Pages. Much of this fervor is due to the excitement of PHP's open source policy. The software and source code are available free on the Internet. Price is not the only factor driving the popularity of PHP. Flexibility, extensibility, and performance are key elements in the success of PHP. Much of the syntax used in PHP was borrowed from C, Perl, and Java. Individuals with basic training in any these languages can pick up PHP's syntax with very little effort. This inherent familiarity also contributes to PHP's increasing popularity. The current main PHP team includes developers from all over the world. Zeev Suraski and Andi Gutmans are in Israel, Shane Caraveo resides in Florida, Stig Bakken is from Norway, Andrei Zmievski is in Nebraska, Sascha Schumann and Thies C. Arntzen are from Germany, Jim Winstead is from Los Angeles, and the father of PHP, Rasmus Lerdorf, resides in North Carolina. Because of PHP's open source, many developers and hobbyists contribute to the PHP's code. The contributions from this unpaid group of experts add to PHP's popularity and its spectacular feature set. PHP version 4 is currently in beta and includes many optimizations and feature improvements. These improvements include a compiler, enabling code to run significantly faster. There is support for caching compiled code, a code optimizer, and a formal debugger. PHP 4 also includes better object-oriented syntax, self-contained extensions, and a thread-safe core. Advantages of PHP 4 PHP has two main competitors: Microsoft's Active Server Pages and Allaire's ColdFusion. PHP has many advantages over these commercial packages. As mentioned previously, one of the main advantages PHP has over ASP and ColdFusion is its price. PHP is completely free and is available for download at hundreds of mirror sites all over the globe. For many, this advantage is the deciding factor; however, there are many more technical reasons to use PHP. PHP has the capability to run on NT and UNIX. It is just as easy to build complex Web sites that run on either platform. This cross-platform compatibility makes the transition from NT to UNIX an easy proposition. Before PHP, converting Web code meant that changing a server operating system was an extremely painful task. Operating-system . version 3 of PHP. The success of PHP is difficult to gauge, but it has been estimated that there are more than 1 million Web sites using PHP and that number is increasing every month. PHP user. monospaced font to signify that these are part of the PHP language. Here is an example: PHP Developer’s Dictionary IT-SC book 13 "You can use the phpinfo() function to…" • Italics— Within. well on your use of the PHP Developer's Dictionary. R. Allen Wyke Michael J. Walker Robert Cox PHP Developer’s Dictionary IT-SC book 14 Chapter 1. Basic PHP Background and History

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

  • Đang cập nhật ...

Tài liệu liên quan