PHP Design First chapter what is PHP?

Source: Internet
Author: User
Tags arrays copy include php language php and php code php programming php source code


PHP is a combination of programming languages and application servers. PHP is similar to other programming languages, using variables to store temporary values and using operators to process variables. The real value of PHP is that it is an application server.

When it comes to application servers, I mean a program that combines several different technologies into one complete suite. These technologies include:
* A strong programming language.
* Access data stored in the database.
* Support Internet protocols, especially e-mail and HTTP protocols.

Note: There are many other features of the application server, and only the most basic features are listed here.

By providing front-end interfaces for these various technologies, PHP can make work easier.
The rest of this chapter describes many of the intricacies of PHP and its role in application development.

1.1 Origin
PHP was created by Rasums Lerdorf, which began as a simple program written in Perl to record Rasums Lerdorf's own online resume. Later it was again written in C to extend the scope to access the database. During this period, many people Lerdorf to Rasums to copy the program for their own use. Rasums Lerdorf wrote some documentation about this program and published PHP v1.0. Later, more and more people began to use PHP, and strongly asked to add some other features, such as loop statements and array variables. At this point, other programmers began to participate in the PHP source code (mainly Zeev Suraki and Andi Gutmans), it is obvious that at this time of PHP for future development, must be rewritten. As a result, PHP v3.0 appears.
1.2 Characteristics
The features of PHP include:
* Open Source-All the PHP source code can be obtained. In fact, all the source code is included in the CD that comes with the book.
* No running costs-PHP is free.
* server-based-because PHP is running on the Web server side, PHP programs can be large and complex without slowing down the client's performance.
* Cross-platform-although this book is focused on Linux, PHP programs can run on Unix,linux, or under Windows operating systems.
* Embed HTML-because the PHP language can be embedded inside HTML, PHP is easy to learn.
* Simple language-unlike Java and C + +, the PHP language adheres to the base language, yet its functionality is powerful enough to support any type of Web site.
* High Efficiency-PHP systems consume less system resources than other explanatory languages. When PHP is part of the Apache Web server, the running code does not need to tune the external binaries, and the server interpreter script does not have to bear any additional burdens.
* Parsing XML-users can build a PHP version that can read XML information.
* Database Modules-users can use PHP to access Oracle, Sybase, MS SQL, Adabase D, MySQL, mSQL, PostgreSQL, DBase, Filepro, Unix dbm, informix/ Databases such as Illustra, and any databases that support ODBC standards.
* File Access--php has many supporting file access functions.
* Text Processing--php has many functions that handle strings, including the ability to match patterns.
* Complex variable--php supports variables such as scalars, arrays, associative arrays, and so on, providing a solid foundation for the user to support other advanced data structures.
* Image processing-users can use PHP to create images dynamically.
* More Other features!

How much does it cost to 1.3 php?
PHP is free of charge. All the source code, documents are free to copy, compile, print and distribute. Any user-written program in PHP is owned by the user, and can be handled in accordance with his or her own volition without paying any royalties. As far as PHP itself is concerned, users can publish their own programs indefinitely.
However, for good reason, PHP is not a complete "public domain" code. If the PHP source is a complete public domain code, it is very likely that someone will make a small change to the PHP code, and then compile and sell-in other words, from its creator out. But on the other hand, if the source code is not published, it is difficult to make users who want to use it to feel at ease.
The GNU General Public License is a way to release free software that prevents others from owning the fruits of your labor. Under the GNU license, the source code is free to be released and can be used by anyone, but any program originating from this source must be published in the same kind of license. In other words, if users write their own programs from any GNU-licensed source code, users must give anyone who wants the source a common source.
1.4 PHP language can be embedded in HTML
When a user is programming with a classic programming language (such as C or Pascal), all code must be compiled into an executable file, and then the executable file generates HTML markup for the remote Web browser when it is run. On the other hand, PHP does not need to be compiled (at least not compiled into an executable file). Users can mix their code into HTML. For example, the following code will display "hello,world!", and the PHP code is shown below in bold text.

<HTML>
<HEAD><TITLE>Test</TITLE></HEAD>
<BODY>
? PHP $string = ' world! '; ?>
</BODY>
</HTML>

The PHP Application Server (the main writing purpose of this book) is tightly integrated into the Apache Web server, and you can call them two at a time in one program. When a Web browser requests a PHP Web page, the PHP portion of the Web server is invoked to explain. The Web server is looking in the requested Web page. Php...? > tag and execute the PHP code as required.
The output generated by the PHP code will replace the. Php...? > tags. For example, when the PHP code is running, the previous Web page will become as follows:

<HTML>
<HEAD><TITLE>Test</TITLE></HEAD>
<BODY>
<H1>Hello,world!</H1>
</BODY>
</HTML>

Notice that all the PHP code disappears, leaving only the HTML statements. The HTML statements generated by the PHP code are shown in bold form in the example above.

1.5 PHP language is running on the Web server side
When developing an Internet application, it is important to be aware of where the application is running. PHP is always running on the server side. Don't scoff at the emphasis on this point. When you later consider planning some of your application's features, some people may be wrong about where the application is running, and don't let yourself be one of them.
Because Java Applets,activex, or JavaScript, is running in the client's Web browser, PHP cannot compare directly to them. However, it's easy to combine these languages with PHP, using PHP to easily generate any HTML code you need, and of course activating Java applets and ActiveX controls, and dynamically generating JavaScript statements. This may not make sense when it is unfamiliar to the development of Internet applications, but after reading the book, it becomes very clear.
1.6 PHP Everywhere
Ubiquitous is the passionate word that is often used, by July 1999, there will be about 600,000 of Web sites using php,1999 Summer's big development of Linux and open code campaigns is likely to make a breakthrough for the PHP community. You can see its development trend chart on the HTTP://WWW.PHP.NET/USAGE.PHP3 site.
In addition, the PHP mailing list receives approximately 80 emails a day and receives approximately 2,500 emails a month, which means that PHP is a very active development community. There are several business companies using PHP, such as Mitsubishi Motors, Volvo, Red Hat Software, E*trade, the USA Bank, the San Francisco giants and San Diego Zoo, and so on.
1.7 php similar to C or Java?
PHP programs and C programs have a slightly similar place, because PHP is derived from C, Perl, and Java. Some of the more troubling aspects of C (such as processing string techniques) are no longer troublesome in PHP, thanks to techniques similar to those used in Perl. PHP also does not include some object-oriented features in Java.
PHP can handle some low-level tasks very well, if the code needs to run very fast, you can easily use C for the PHP program to write modules.
is 1.8 php better than ColdFusion, Active Server page, or Java server page?
In the popular way of deliberation, I always answer, "can be, or may not be".
The answer is due to its cost (free of charge) as well as the wide network of support available worldwide through the mailing list and IRC. At the same time, PHP is constantly developing, if you want a feature that PHP does not now, please wait a few months, someone quickly for PHP programming and add this feature.
The answer is no, because commercial software has more features than PHP. For example, Allaire's ColdFusion has a proven and reliable search engine component. Microsoft's Active Server page technology provides the ability to combine Outlook, e-mail, and workgroup programs. Java Server page allows users to use a large number of open source modules on the Internet.
1.9 Summary
For PHP, which is all over the Internet, this chapter only briefly mentions some of its features, and this chapter explains why PHP is one of the best programming tools when designing an Internet application.
The next chapter, "Installing PHP", will step through the compilation process of PHP, the installation process, and the testing process.

-->



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.