Zend PHP Certification Study Guide - Yola

Transcription

00 7090 fm7/16/048:45 AMPage i

00 7090 fm7/16/048:45 AMPage iiZend PHP Certification Study GuideCopyright 2005 by Sams PublishingAcquisitions EditorShelley JohnstonAll rights reserved. No part of this book shall be reproduced, storedin a retrieval system, or transmitted by any means, electronic,mechanical, photocopying, recording, or otherwise, without writtenpermission from the publisher. No patent liability is assumed withrespect to the use of the information contained herein. Althoughevery precaution has been taken in the preparation of this book, thepublisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the useof the information contained herein.Development EditorDamon JordanInternational Standard Book Number: 0-672-32709-0IndexerChris BarrickLibrary of Congress Catalog Card Number: 2004093764Printed in the United States of AmericaFirst Printing: July 200407 06 05 044 3 2 1TrademarksAll terms mentioned in this book that are known to be trademarksor service marks have been appropriately capitalized. SamsPublishing cannot attest to the accuracy of this information. Use of aterm in this book should not be regarded as affecting the validity ofany trademark or service mark.Warning and DisclaimerEvery effort has been made to make this book as complete and asaccurate as possible, but no warranty or fitness is implied.The information provided is on an “as is” basis.Bulk SalesSams Publishing offers excellent discounts on this book whenordered in quantity for bulk purchases or special sales. For moreinformation, please contactU.S. Corporate and Government or sales outside of the U.S., please contactInternational comManaging EditorCharlotte ClappProject EditorGeorge E. NedeffCopy EditorRhonda Tinch-MizeProofreaderLeslie JosephTechnical EditorSara GolemonPublishing CoordinatorVanessa EvansMultimedia DeveloperDan ScherfBook DesignerGary AdairPage LayoutKelly Maish

00 7090 fm7/16/048:45 AMPage iiiContents at a GlanceIntroduction 11 The Basics of PHP 52 Object-Oriented PHP 353 PHP and the Web 494 Arrays 615 Strings and Regular Expressions 896 File Manipulation 1057 Managing Dates and Times 1158 Managing Email 1279 PHP and Databases 14510 Stream and Network Programming 15711 Security 17712 Debugging and Performance 18513 Getting Ready for the Certification Exam 201Practice Exam Questions 209Glossary 215Index 225

00 7090 fm7/16/048:45 AMPage ivTable of ContentsIntroduction1What Does This Guide Cover? 1How Is the Guide Organized? 2Other Resources You Might Want to Consult 31 The Basics of PHP 5Terms You’ll Need to Understand 5Techniques You’ll Need to Master 6Language and Platform 6Getting Started 6The Special ? ? Tags 8Scripts and Files 8Manipulating Data 9Numeric Values 9String Values 10Boolean Values 11Arrays 11Objects 11The NULL Data Type 11Resources 12Identifiers, Constants, and Variables 12Variables 12Variable Substitution in Strings 13Statements 13Constants 14Operators 14The Assignment Operator 14Arithmetic Operators 15Bitwise Operators 16Error-control Operators 16String Operators 17Comparison Operators 17Logical Operators 18Typecasting 19

00 7090 fm7/16/048:45 AMPage vCombined Assignment Operators 19Combining Operations: Operator Precedence andAssociativity 19Conditional Structures 21Alternative if-then-else Syntax 22Short-form if-then-else 22The case Statement 23Iteration and Loops 25The while Structure 25The do-while Structure 26The for Loop 26Continuing a Loop 28Functions and Constructs 28Functions and Variable Scope 30Functions with Variable Parameters 31Variable Variables and Variable Functions 32Exam Prep Questions 332 Object-Oriented PHP 35Terms You’ll Need to Understand 35Techniques You’ll Need to Master 36Getting Started 36Instantiating a Class: Objects 37Classes as Namespaces 37Objects and References 38Implementing Inheritance 42Magic Functions: Serializing Objects 44Exam Prep Questions 453 PHP and the Web 49Terms You’ll Need to Understand 49Techniques You’ll Need to Master 49Server-side Versus Client-side 50HTML Forms 51Cookies 54Sessions 56Exam Prep Questions 57

00 7090 fmvi7/16/048:45 AMPage viContents4 Arrays61Terms You’ll Need to Understand 61Techniques You’ll Need to Master 62Creating Arrays 62Using the Array Operator 63Counting the Number of Elements inan Array 65Assigning Values from an Array to MultipleVariables 65Multidimensional Arrays 66Navigating Arrays 68Using foreach 69Using the Internal Pointer 70Using a Callback 71Manipulating Keys 72Checking if an Element Exists 73Changing the Array of Keys 74Sorting an Array by Its Keys 74Manipulating Arrays 76Sorting Multidimensional Arrays 78Randomizing Arrays 81Merging Arrays 82Intersection and Difference 84Serializing Arrays 85Exam Prep Questions 865 Strings and Regular Expressions 89Terms You’ll Need to Understand 89Techniques You’ll Need to Master 89Comparing Strings 89Comparison with and 90Using strcmp and Friends 91Matching Portions of Strings 92Formatting Strings 93printf Formats 93printf() Family Functions 95

00 7090 fm7/16/048:45 AMPage viiContentsExtracting Data from Strings 95Extracting Substrings by Offset 96Extracting Formatted Data 96Modifying Strings 97Modifying Substrings by Offset 97Replacing Substrings 97Regular Expressions 98Basic PCRE Syntax 98Extracting Data with Regular Expressions 100Pattern Replacement with RegularExpressions 101Splitting Strings into Components 101Exam Prep Questions 1026 File Manipulation 105Techniques You’ll Need to Master 105Terms You’ll Need to Understand 105Opening Files 106Closing Files 107Reading from a File 107Writing to a File 108Determining Information About Files 109Manipulating Files on the Filesystem 110Copying, Deleting, and Moving Files 110Changing Ownership and Permissions 111Locking Files 111Miscellaneous Shortcuts 112file() 112readfile() 112file get contents() 113Exam Prep Questions 1137 Managing Dates and Times 115Terms You’ll Need to Understand 115Techniques You’ll Need to Master 115How PHP Handles Dates 115Getting the Current Time Stamp 117vii

00 7090 fmviii7/16/048:45 AMPage viiiContentsGetting a Date Array 117Formatting a Date String 119Getting a UNIX Time Stamp from a Date Array 123Getting A UNIX Time Stamp from a String 123Exam Prep Questions 1248 Managing Email 127Introduction 127Terms You’ll Need to Understand127Techniques You’ll Need to Master 127How Email Is Delivered 127MTA—Mail Transport Agent 128SMTP—Simple Mail Transport Protocol 128MX Records 128MUA—Mail User Agent 129SASL—Simple Authentication andSecurity Layer 129Other Emerging Technologies 129Preparing PHP 130If You Are Using PHP on UNIX 130If You Are Using PHP on Windows orNetware 131Sending Email 132Sending an Email to More Than OneRecipient 132Managing Email Headers 133The Cc: and Bcc: Headers 133The From: Header 133Setting the Subject 133Formatting an Email Message 133Plain-Text Emails 133Basic HTML Emails 134Attaching a File to a Message 135Attached Images for HTML Emails 137Using Extra Command-Line Parameters 139A Word About Email Delivery 139Further Reading 140Exam Prep Questions 141

00 7090 fm7/16/048:45 AMPage ixContents9 PHP and Databases 145Terms You’ll Need to Understand 146Techniques You’ll Need to Master 146“Databasics” 146Indices 147Writing Good Indices 147Primary Keys 148Foreign Keys and Relations 148Creating Tables or Adding and Removing Rows 149Inserting a Row 149Deleting Rows 149Retrieving Information from a Database 150Extracting Data from More Than One Table 150Aggregate Functions 151Sorting 152Transactions 153PHP and Databases 153There’s Date and Date 154Exam Prep Questions 15410 Stream and Network Programming 157Terms You’ll Need to Understand 157Techniques You’ll Need to Master 157php.ini Settings to Understand 157What Are File Wrappers? 158How Do You Choose Which File Wrapper IsUsed? 158What Built-In Wrappers Does PHPProvide? 159Not All Wrappers Are Created Equal 160Using a File Wrapper 162Correctly Detecting Line Endings 162Closing a File Wrapper 162Other Functions That Work with FileWrappers 163Introducing Streams 163What Is Stream Metadata? 163Pipelines 165What Is the Stream Transport? 165ix

00 7090 fmx7/16/048:45 AMPage xContentsWhat Is the Stream Context? 165How Do Streams Affect Me? 166Connecting to Remote Hosts Using Sockets 166When Should I Use a Socket Instead of a FileWrapper? 166What Network Transports Does PHPSupport? 167How Do I Open a Socket? 167Persistent Sockets 168Timeouts When Opening a Socket 168How Do I Use a Socket? 169Blocking Mode 169Read/Write Timeouts 170Closing a Socket 171Further Reading 172Exam Prep Questions 17211 Security177Terms You’ll Need to Understand 177Techniques You’ll Need to Master 177Data Filtering 178Register Globals 178SQL Injection 179Command Injection 180Cross-Site Scripting 180Shared Hosting 180Exam Prep Questions 18112 Debugging and Performance 185Terms You’ll Need to Understand 185Techniques You’ll Need to Master 185Coding Standards 186Flattening if Statements 187Splitting Single Commands AcrossMultiple Lines 188Concatenation Versus Substitution 188Choose Your Opening Tags Carefully 189One Equal,Two Equals,Three Equals 189There’s Equal and Equal 190Testing for Resource Allocation 190

00 7090 fm7/16/048:45 AMPage xiContentsTernary Operators and if Statements 191Logging and Debugging 192Using Debuggers 193Optimizing Performance 193Hardware Issues 193Web Server Issues 194Avoid Overkill 194Zip It Up 195Database Optimizations 195Keep Your Code Simple 196Caching Techniques 196Bytecode Caches 196Exam Prep Questions 19713 Getting Ready for theCertification Exam 201What the Exam Tests 201How to Register 201Registration via Pearson VUE Call Center 202Registration via the Person VUE Website 202Registration at the Test Center 202What to Expect at the Test Center 202How the Exam Works 203Exam Instructions 203NDA (NONDISCLOSUREAGREEMENT) 203Viewing Backward and Forward 204Reviewing Your Answers 204Your Comments 204What Kinds of Questions Are Asked? 204Single Choice Questions 204Multiple Choice Questions 205Fill in the Blanks Questions 206Open Questions 207Practice Exam Questions 209Glossary 215Index 225xi

00 7090 fm7/16/048:45 AMPage xiiAbout the AuthorsStuart Herbert has designed and implemented solutions for major companies such asEurostar,Vodafone, and HP, and has been the lead maintainer of the Generic NQSproject since 1994. A former systems manager with Orange UK, Stuart is currently oneof the developers for Gentoo Linux, where he looks after Gentoo’s installer for webbased packages.Daniel Kushner is the director of training and certification at Zend Technologies. Asdirector of training and certification, Daniel is responsible for the Zend PHPCertification program. In addition to designing the certification program, he developedthe Zend PHP Training program, which provides the necessary study guide and classesto help PHP developers become Zend PHP certified. As part of the program, Daniel alsoinitiates and maintains business relationships and partnerships with worldwide PHPtraining facilities. Prior to Zend Technologies, Daniel was a senior software engineer atDynamicLogic, responsible for developing integrated research recruitment solutions usedin name brand websites including Yahoo!, AOL, and Lycos. Previously, he was a PHPfreelancer, developing front and backend web applications, including e-commerce integration, member services and personalization, auction management, email delivery systems, and online file manipulation services for companies such as MTV, Arista,ViacomOutdoor, Accuweather, and Dell Computer Corporation.While freelancing, Daniel wasalso a PHP training instructor, where he worked with developers from highly acclaimeduniversities such as Harvard and Columbia and with companies such as Google, The NewYork Times, and the American Museum of Natural History.George Schlossnagle is a principal at OmniTI Computer Consulting, a Marylandbased tech company specializing in high-volume web and email systems. Before joiningOmniTI, George lead technical operations at several high-profile community websites,where he developed experience managing PHP in very large enterprise environments.George is a frequent contributor to the PHP community. His work can be found in thePHP core, as well as in the PEAR and PECL extension repositories. George also writesprolifically on PHP. He is the author of Advanced PHP Programming (Developers Library,2004), as well as numerous articles for both print and online journals. He served as asubject matter expert for the Zend PHP Certification exam.Chris Shiflett is a frequent contributor to the PHP community and one of the leadingsecurity experts in the field. His solutions to security problems are often used as pointsof reference, and these solutions are showcased in his talks at conferences such asApacheCon and the O’Reilly Open Source Convention and his articles in publicationssuch as PHP Magazine and php architect. “Security Corner,” his monthly column forphp architect, is the industry’s first and foremost PHP security column. Chris is the authorof the HTTP Developer’s Handbook (Sams Publishing) and PHP Security (O’Reilly andAssociates). In order to help bolster the strength of the PHP community, he is also leading an effort to create a PHP community site at PHPCommunity.org. Chris is also asubject matter expert for the Zend PHP Certification Exam.

00 7090 fm7/16/048:45 AMPage xiiiBjörn Schotte is a German PHP veteran. He co-founded the first German-speakingportal for PHP topics in early 1999, co-organized the first worldwide PHP conference,and has been editor-in-chief of PHP Magazin since 2001. He also co-foundedThinkPHP, Germany’s No. 1 PHP solution company dealing mainly with large PHPapplications for clients such as HypoVereinsbank, Sixt, Lycos Europe, E.ON, CapGemini, Ernst & Young, and others. His company now consists of a team of more than15 people, including PHP core developers. Among his other accomplishments, he hasbeta-tested the MySQL Core Certification Program, is a well-known speaker at conferences such as CeBit Systems and LinuxTag where he promotes PHP in the enterprise,and has taught over 250 people in his PHP courses since 2000. You can reach him atschotte@mayflower.de. His company’s website is at http://www.thinkphp.de/.Marco Tabini is the publisher of php architect (http://www.phparch.com), the premiermagazine for PHP professionals, and has worked on websites for clients ranging fromsmall startup operations to the Fortune 500s. Despite having been an IT industry professional for the last fifteen years, he still manages to maintain a reasonable level of sanity—at least most of the time. Marco is also a subject matter expert for the Zend PHPCertification Exam.

00 7090 fm7/16/048:45 AMPage xivWe Want to Hear from You!As the reader of this book, you are our most important critic and commentator.We valueyour opinion and want to know what we’re doing right, what we could do better, whatareas you’d like to see us publish in, and any other words of wisdom you’re willing topass our way.You can email or write me directly to let me know what you did or didn’t like aboutthis 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, andthat due to the high volume of mail I receive, I might not be able to reply to every message.When you write, please be sure to include this book’s title and author as well as yourname and phone or email address. I will carefully review your comments and share themwith the author and editors who worked on the book.Email:Mail:opensource@samspublishing.comMark TaberAssociate PublisherSams Publishing800 East 96th StreetIndianapolis, IN 46240 USAReader ServicesFor more information about this book or others from Sams Publishing, visit our websiteat www.samspublishing.com.Type the ISBN (0672327090) or the title of the book inthe Search box to find the book you’re looking for.

00 7090 fm7/16/048:45 AMPage xvForewordPHP has grown a lot since its inception in 1997. PHP 4, released in May 2000, gainedpopularity and is already installed on more than a quarter of the Internet Web servers inthe world—more than any other Web platform in existence as of mid-2003.Top-notchperformance, the availability of good development tools such as the Zend Studio, and theexplosive growth in availability of extension support for any third-party library or information store you can imagine have helped PHP become the best platform for developing and deploying Web applications.With each passing month, it is becoming even more difficult to call PHP the “hiddengem of the Web.” It is still a gem all right, but hidden? No longer. High profile companies, such as Lufthansa,Yahoo!, and Electronic Arts are now using PHP extensively, giving PHP a corporate “stamp of approval” for those who were waiting for one. Anincreasing number of companies are joining them every day, disproving those who saythat PHP is not ready for the enterprise.With PHP 5, this trend is likely to continueeven more rapidly.As the scope of PHP widens, and as larger companies hire PHP personnel, they needto have a standard, reliable way of assessing one’s abilities and capabilities with PHP.Moreover, the need for PHP developers to have an “official blessing” of their PHP skillsis on the rise as the market becomes more competitive.The Zend PHP Certificationprogram is aimed at providing a solution for both these companies and developers byproviding a standard, objective, and comprehensive measurement of one’s PHP skills.This is exactly where this book comes into the picture. Zend PHP Certification StudyGuide has been written by some of the same people who designed the Zend PHPCertification. It goes over all the topics that are required by the certification, placing anemphasis on the things that you need to keep in mind in order to pass the certificationexam successfully. It is a must have for anybody planning to become a Zend CertifiedPHP Engineer—at least those who don’t enjoy retaking exams.Good luck with your test!Andi GutmansCo-founder andVice President of TechnologyZend TechnologiesZeev SuraskiCo-founder andChief Technology OfficerZend Technologies

00 7090 fm7/16/048:45 AMPage xvi

01 7090 Intro7/16/048:43 AMPage 1IntroductionIF YOU’RE READING THIS BOOK, you’ve probably made a decision that becoming a ZendCertified Engineer is an important step in your career. And, indeed, it might well be—the certification exam will test your knowledge of PHP in many areas, ranging from thebasics to the more complex topics. As PHP’s adoption grows inside the enterprise, beingcertified can mean that you will have an edge when that dream job comes along!The exam was designed by a number of well-known people in the PHP communityin collaboration with experts in the field of computer-assisted testing.They approachedit with a simple set of goals:nnnTest the level of PHP knowledge of the candidate without prejudice to othertechnologiesUse a set of testing questions that reflect real-world scenarios as accurately as possibleAvoid questions that rely on a person’s understanding of the language rather thanhis or her understanding of PHP and its related programming techniquesIt’s very important to understand these points as you approach your studies, as well as theexam itself, in particular when it comes to testing technologies that are used in conjunction with PHP.The test authors decided that, rather than relying on assumptions as towhat other technologies a PHP programmer is likely to use in his or her daily job, theexam should focus on PHP itself and on those topics that a developer deals with oftenwithout any ties to a particular product.Thus, although you will probably encounter one or more questions about databasedevelopment during your exam, they will not be linked to a particular DBMS, such asMySQL or Oracle. Rather, they will deal with the general concepts of database programming and the standard SQL language.What Does This Guide Cover?The Zend PHP Certification Study Guide covers every topic that is part of the exam. Itwas developed by some of the very same authors who designed the exam’s questions andwas thoroughly reviewed to ensure that it provides every bit of information required tocover each subject appropriately.

01 7090 Intro27/16/048:43 AMPage 2IntroductionOne thing that this book is not is a PHP development tutorial or a reference book onthe language and its extensions. Our goal in developing the guide is to provide you witha study aid that can help you focus on those topics that you will be questioned on during the exam. It is not a substitute for your experience as a PHP programmer in the realworld, and it does not provide you with a “magic bullet” that will make you pass the testif you have never written a line of code in your life.Remember that this book—and the certification guide—are based on PHP 4.This isessential, particularly when it comes to object-oriented programming, where the differences between PHP 4 and PHP 5 are very pronounced.Whatever you read in this book,as well as anything that shows up in a question at the exam, does not take PHP 5 intoaccount whatsoever.Many of the questions in the exam have been designed so that they mimic scenariosthat you are likely to encounter in real life. Many of them involve the practical analysisof snippets of PHP code that might contain bugs or that might rely on PHP’s particularbehavior in order to reach a particular goal that is not immediately obvious.These are not trick questions—they are designed to determine how well you understand the unique way in which PHP works so that, when a similar problem occurs inreal life, you will be able to tackle it properly and efficiently.We have designed this guide along the same lines. Although you will find a goodamount of theory among the pages of this book, it will always be presented to you withan eye to its practical applications. In addition, each chapter includes a set of samplequestions that are similar in structure to the ones you will find at the exam (althoughthey are not the same, of course).In line with our goal of giving you all the tools you need to successfully pass theexam, we thought you might also want to know what taking the exam is like. Chapter13, “Getting Ready for the Certification Exam,” discusses what to expect when you goto the certification center and how the exam works.How Is the Guide Organized?We intended the book to be read as a tutorial, rather than a reference. As such, the bestway is to start with Chapter 1, “The Basics of PHP,” and move your way to the end, aseach chapter introduces new concepts by building on the information provided by thechapters that precede it.While reading the guide, it’s useful to remember that you are preparing for an exam.Read each section carefully and try to remember not only the essential points, but alsothose elements that might be useful while you’re trying to tackle the exam.If you already have experience in PHP development—as you probably will if youintend to take the exam—you might think that some of the topics we have covered inthe guide are quite basic—and, to some extent, they are. However, they are covered fromthe point of view of the exam, and this means that you might discover some facts thatyou are not aware of because you have not encountered a real-life scenario in whichthey are relevant, but that might well show up in a question during your test.

01 7090 Intro7/16/048:43 AMPage 3IntroductionFinally, don’t forget to peruse the sample questions that you can find at the end ofeach chapter. As we mentioned earlier, they are similar in structure (although not in content) to the real ones, and they rely heavily on the proper analysis of practical samplecode. Answering them can help you not only to determine how well your studies areprogressing, but also to familiarize yourself with the way the questions are phrased in theexam.Other Resources You Might Want to ConsultAs we mentioned at the beginning of this introduction, there is no substitute for experience when it comes to passing the exam.You’ll find that very few questions are of adidactical nature and that most require some practical steps in order to find the rightanswer.Although this guide covers all the topics that are part of the exam, you might want toexamine some of the subjects in more depth.The best resource for this purpose is thePHP Manual, which you can find online at http://www.php.net or through your localPHP mirror. In fact, it’s probably a good idea to keep the manual handy while you’rereading this book and refer to it for additional information on a specific topic. Simplyremember that the manual covers all versions of PHP, whereas this guide and the examare specific to PHP 4.3

01 7090 Intro7/16/048:43 AMPage 4

02 7090 ch017/16/048:44 AMPage 51The Basics of PHPPHP IS THE MOST POPULAR WEB-DEVELOPMENT language in the world. According toestimates compiled in April 2004, there are over fifteen million unique domains—andalmost two million unique IPs—on the World Wide Web that reside on servers wherePHP is supported and used.The term “PHP” is actually a “recursive acronym” that stands for PHP: HypertextPreprocessor. It might look a bit odd, but it is quite clever, if you think of it. PHP is a“scripting language”—a language intended for interpretation and execution rather thancompilation such as, for example, C.The fact that PHP is interpreted and not compiled, however, does not mean that it isincapable of meeting the demands of today’s highly intensive web environments—in fact,a properly written PHP script can deliver incredibly high performance and power.Terms You’ll Need to UnderstandnnnnnnnnnnnLanguage and PlatformLanguage constructData typeOpening and closing tagsExpressionVariableOperation and operator precedenceConditional structuresIteration and LoopsFunctionsVariable variables and variable functions

02 7090 ch0167/16/048:44 AMPage 6Chapter 1 The Basics of PHPTechniques You’ll Need to MasternnnnnnnnnCreating a scriptEntering PHP modeHandling data typesType casting and type jugglingCreating statementsCreating operations and expressionsWriting functionsHandling conditional statementsHandling loopsLanguage and PlatformThe two biggest strengths of PHP are its simplicity and the incredible set of functionalitythat it provides. As a language, it incorporates C’s elegant syntax without the hassle ofmemory and pointer management, as well as Perl’s powerful constructs—without thecomplexity often associated with Perl scripts.As a platform, PHP provides a powerful set of functions that cover a multitude of different needs and capabilities. Programmers who work on commercial platforms such asMicrosoft ASP often marvel at the arsenal of functionality that a PHP developer has athis fingertips without the need to purchase or install anything other than the basic interpreter package.What’s more, PHP is also extensible through a set of well-defined C APIsthat make it easy for anyone to add more functionality to it as needed.You have probably noticed that we have made a distinction between “language” and“platform.” By the former, we mean PHP proper—the body of syntactical rules andconstructs that make it possible to create a set of commands that can be executed in aparticular sequence.The latter, on the other hand, is a term that we use to identify thosefacilities that make it possible for the language to perform actions such as communicating with the outside, sending an email, or connecting to a database.The certification exam verifies your knowledge on both the language and the platform—after all, a good programmer needs to know how to write code and how to useall the tools at his disposal. Therefore, it is important that you acquaint yourself withboth aspects of PHP development in order to successfully pass the exam.Getting StartedThe basic element of a PHP application is the script. A PHP script contains a number ofcommands that the PHP interpreter reads, parses, and executes.

02 7090 ch017/16/048:44 AMPage 7Getting StartedBecause PHP is designed to manipulate text files—such as HTML documents—andoutput them, the process of mixing hard-coded textual content and PHP code is facilitated by the fact that unless you tell it otherwise, the PHP interpreter considers the contents of the script file as plain text and outputs them as they are.It’s only when you explicitly indicate that you are embedding PHP code inside a filethat the interpreter goes to work and starts parsing and executing commands.This isdone by using a special set of opening and closing tags. In part because of historical reasonsand in order to promote maximum flexibility, PHP supports three different sets of tags:PHP opening ( ?php) and closing (? ) tagsnnnnHTML-style tags ( script“Short” tags: ? and ? “ASP-style” tags: % and % language ”php” and /script )The full PHP tags are always available to a script, whereas short tags and ASP-style tagsmight or might not be available to your script, depending on how the particular installation of the PHP interpreter used to execute it is configured.This is made necessary bythe fact that short tags can interfere with XML documents, whereas ASP-style tags caninterfere with other languages that can be used in conjunction with PHP in a chain ofpreprocessors that manipulate a file multiple times before it is outputted.Let’s take a look at the following sample PHP script: html head title This is a sample document /title body ?phpecho ‘This is some sample text’;? /body /html As you can see, this document looks exactly like a normal HTML page until the interpreter hits the ?php tag, which indicates that text following the tag should be interpreted as PHP commands and exe

the Zend PHP Training program,which provides the necessary study guide and classes to help PHP developers become Zend PHP certified.As part of the program,Daniel also initiates and maintains business relationships and partnerships with worldwide PHP training facilities.Prior to Zend