THIS CHAPTER GIVES YOU A QUICK OVERVIEW of PHP syntax and language constructs.If you are already a PHP programmer, it might fill some gaps in your knowledge. If youhave a background using C, Active Server Pages (ASP), or another programming language,it will help you get up to speed quickly.In this book, you’ll learn how to use PHP by working through lots of real-worldexamples taken from our experiences in building e-commerce sites.
Often, programmingtextbooks teach basic syntax with very simple examples.We have chosen not to do that.We recognize that often what you want to do is get something up and running, to understand how the language is used, instead of plowing through yet another syntax and function reference that’s no better than the online manual.Try the examples.Type them in or load them from the CD-ROM, change them,break them, and learn how to fix them again.This chapter begins with the example of an online product order form to show how variables, operators, and expressions are used in PHP.
It also covers variable types and operator precedence.You learn how to access form variables and manipulate them by working out the total and tax on a customer order.You then develop the online order form example by using a PHP script to validate the input data.You examine the concept of Boolean values and look at examples using if, else, the ?: operator, and the switch statement. Finally, you explore looping bywriting some PHP to generate repetitive HTML tables.
Key topics you learn in this chapter include :
1 Embedding PHP in HTML
2 Adding dynamic content
3 Accessing form variables
4 Understanding identifiers
5 Creating user-declared variables
6 Examining variable types
7 Assigning values to variables
8 Declaring and using constants
9 Understanding variable scope
10 Understanding operators and precedence
11 Evaluating expressions
12 Using variable functions
13 Making decisions with if, else, and switch
14 Taking advantage of iteration using while, do, and for loops
Monday, December 8, 2008
Saturday, December 6, 2008
First Chapter in PHP tutorials for dummies - What Is New in PHP 5.0?
You may have recently moved to PHP 5.0 from one of the PHP 4.x versions. As you would expect in a new major version, it has some significant changes.The Zend engine beneath PHP has been rewritten for this version. Major new features are as follows:
1 Better object-oriented support built around a completely new object model (see Chapter 6,“Object-Oriented PHP”)
2 Exceptions for scalable, maintainable error handling (see Chapter 7,“Exception Handling”)
3 SimpleXML for easy handling of XML data (see Chapter 33,“Connecting to Web Services with XML and SOAP”)
Other changes include moving some extensions out of the default PHP install and into
the PECL library, improving streams support, and adding SQLite.
Generally, this sites is divided into five main parts:
Part I,“Using PHP,” provides an overview of the main parts of the PHP language with examples. Each example is a real-world example used in building an e-commerce site rather than “toy” code.We kick off this section with Chapter 1,“PHP Crash Course.” If you’ve already used PHP, you can whiz through this chapter. If you are new to PHP or new to programming, you might want to spend a little more time on it. Even if you are quite familiar with PHP, you will want to read Chapter 6,“Object-Oriented PHP,” because the object-oriented functionality has changed significantly in PHP5.
Part II,“Using MySQL,” discusses the concepts and design involved in using relational database systems such as MySQL, using SQL, connecting your MySQL database to the world with PHP, and employing advanced MySQL techniques, such as security and optimization.
Part III,“E-commerce and Security,” covers some of the general issues involved in developing an e-commerce site using any language.The most important of these issues is security.We then discuss how you can use PHP and MySQL to authenticate your users and securely gather, transmit, and store data.
Part IV,“Advanced PHP Techniques,” offers detailed coverage of some of the major built-in functions in PHP.We have selected groups of functions that are likely to be useful when building an e-commerce site.You will learn about interaction with the server, interaction with the network, image generation, date and time manipulation, and session variables.
Part V,“Building Practical PHP and MySQL Projects,” is our favorite section. It deals with practical real-world issues such as managing large projects and debugging, and provides sample projects that demonstrate the power and versatility of PHP and MySQL.
We will discover all these chapter in next posting..
1 Better object-oriented support built around a completely new object model (see Chapter 6,“Object-Oriented PHP”)
2 Exceptions for scalable, maintainable error handling (see Chapter 7,“Exception Handling”)
3 SimpleXML for easy handling of XML data (see Chapter 33,“Connecting to Web Services with XML and SOAP”)
Other changes include moving some extensions out of the default PHP install and into
the PECL library, improving streams support, and adding SQLite.
Generally, this sites is divided into five main parts:
Part I,“Using PHP,” provides an overview of the main parts of the PHP language with examples. Each example is a real-world example used in building an e-commerce site rather than “toy” code.We kick off this section with Chapter 1,“PHP Crash Course.” If you’ve already used PHP, you can whiz through this chapter. If you are new to PHP or new to programming, you might want to spend a little more time on it. Even if you are quite familiar with PHP, you will want to read Chapter 6,“Object-Oriented PHP,” because the object-oriented functionality has changed significantly in PHP5.
Part II,“Using MySQL,” discusses the concepts and design involved in using relational database systems such as MySQL, using SQL, connecting your MySQL database to the world with PHP, and employing advanced MySQL techniques, such as security and optimization.
Part III,“E-commerce and Security,” covers some of the general issues involved in developing an e-commerce site using any language.The most important of these issues is security.We then discuss how you can use PHP and MySQL to authenticate your users and securely gather, transmit, and store data.
Part IV,“Advanced PHP Techniques,” offers detailed coverage of some of the major built-in functions in PHP.We have selected groups of functions that are likely to be useful when building an e-commerce site.You will learn about interaction with the server, interaction with the network, image generation, date and time manipulation, and session variables.
Part V,“Building Practical PHP and MySQL Projects,” is our favorite section. It deals with practical real-world issues such as managing large projects and debugging, and provides sample projects that demonstrate the power and versatility of PHP and MySQL.
We will discover all these chapter in next posting..
Subscribe to:
Posts (Atom)