Home >Backend Development >PHP Tutorial >PHP technology_PHP tutorial

PHP technology_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:23:041032browse

PHP, a nested abbreviation name, is the abbreviation of English "Hypertext Preprocessing Language" (PHP: Hypertext Preprocessor). PHP is an HTML embedded language. PHP is somewhat similar to Microsoft's ASP. Both are "scripting languages ​​embedded in HTML documents" that are executed on the server side. The style of the language is similar to C language. Now It is widely used by many website programmers. PHP's unique syntax is a mix of C, Java, Perl, and PHP's own innovative syntax. It can execute dynamic web pages faster than CGI or Perl. Compared with other programming languages, dynamic pages made with PHP embed the program into the HTML document for execution, and the execution efficiency is much higher than CGI that completely generates HTML tags; compared with the scripting language JavaScript, which is also embedded in the HTML document In contrast, PHP is executed on the server side, taking advantage of the server's performance; the PHP execution engine will also store PHP programs that users frequently access in memory, and other users do not need to compile the program when they access this program once. Just execute the code in the memory directly, which is also one of the manifestations of PHP's high efficiency. PHP has very powerful functions. All CGI or JavaScript functions can be implemented by PHP, and it supports almost all popular databases and operating systems.
PHP was originally created by Rasmus Lerdorf in 1994. It started as a simple program written in Perl language to count visitors to his own website. Later it was rewritten in C language, including access to the database. The first version was released in 1995 as Personal Home Page Tools (PHP Tools). Lerdorf wrote some documents introducing the program and released PHP 1.0. In this early version, simple functions such as guest book and visitor counter were provided. In the future, more and more websites used PHP, and there was a strong need to add some features, such as loop statements and array variables, etc. After new members joined the development team, PHP 2.0 was released in mid-1995. The second version is named PHP/FI (Form Interpreter). PHP/FI added support for mSQL, and has since established PHP's position in dynamic web development. By the end of 1996, there were 15,000 websites using PHP/FI; by mid-1997, the number of websites using PHP/FI exceeded 50,000. In mid-1997, the development plan for the third version was started. The development team joined Zeev Suraski and Andi Gutmans, and the third version was named PHP3. In 2000, PHP4.0 came out again, which added many new features. characteristic.
PHP features include:
Open source code: Virtually all PHP source code is available.
PHP is free.
Based on the server side: Since PHP runs on the server side, no matter how many users or complex programs there are, it will not affect the running speed.
Cross-platform: PHP can run under UNIX, LINUX, and WINDOWS.
Embedded HTML: Because PHP can embed HTML language, it is not difficult to learn.
Simple language: PHP insists on scripting language as the main language, unlike Java, which is C++.
High efficiency: PHP consumes considerably less system resources.
Image processing: use PHP to dynamically create images
PHP3 is closely integrated with the Apache server; plus it is constantly updated and new features are added; and it supports almost all mainstream and non-mainstream databases; and it can be high-speed The execution efficiency has made PHP used by more than 1.5 million sites in 1999. In addition, its source code is completely open to the public. Today, with the rise of Open Source awareness, it is the mainstay in this regard. The constant addition of new function libraries and the vitality of constant updates enable PHP to have more new functions whether on UNIX, LINUX or Windows platforms. It provides rich functions to provide better support in programming.
The core of the entire script program in PHP4.0 has been significantly changed to allow the program execution speed to meet faster requirements. After optimization, the efficiency is better than that of traditional CGI or ASP programs. There are also stronger new functions and a richer function library. Whether you accept it or not, PHP will set off a revolutionary revolution in the field of Web CGI. For a professional Web Master, it will also be one of the required courses.
PHP 4.0 is a more effective and reliable dynamic web page development tool. It runs faster than PHP 3.0 in most cases. Its script description is more powerful and more complex. The most significant feature is the increase in rate ratio. These excellent performances of PHP 4.0 are the result of the redesign of the PHP script engine: the engine was completely rewritten from the bottom up by AndiGutmans and Zeev Suraski. The PHP 4.0 script engine, the Zend engine, uses a more efficient "compile-execute" approach, rather than the "execute-when-parsed" model adopted by PHP 3.0.
PHP4 has added or enhanced many useful features based on version 3.0, mainly as follows:
(1) Alias: In PHP4, you can use references to assign values ​​to variables, which brings great convenience to programming. flexibility.
(2) Expanded API module: PHP 4.0 provides an extended PHP interface module for the extended API module, which is significantly faster than the old API version. Most of the existing and most commonly used interfaces of PHP modules have been converted to use this extended interface.
(3) Automatic resource release: PHP4 adds a reference counting function. The introduction of this new technology enables PHP4 to have automatic memory management functions, reducing the burden on developers.
(4) Boolean type: PHP 4.0 supports Boolean type.
(5) Process generation: PHP 4.0 in the UNIX environment provides a very intelligent and versatile generation process, using a system generation technology based on automake/libtool.
(6) COM/DCOM support: PHP 4.0 provides COM/DCOM support (only for Windows environment), which can seamlessly access and access COM objects.
(7) Very good compatibility with PHP 3.0: PHP 4.0 is nearly 100% backward compatible with PHP 3.0 code. Due to the improved architecture of PHP 4, there are some subtle differences, but most people will probably never encounter this situation.
8) Configuration: PHP4 redesigns and enhances PHP. ini file, which is made using PHP. ini to configure PHP is extremely easy. This file can be registered by Apache (unix system) or by Windows (Windows environment) at runtime.
(9) Encryption support: PHP4 implements complete encryption, these encryption functions are a complete mycrypt library, and PHP 4.0 supports hash functions. Blowfish, TripleDES, MD5, and SHA1 are also some of the encryption algorithms that can be used.
(10) Type checking: PHP 4.0 supports the same operator for type checking: "===" (3 equal sign operator), which checks between two values ​​and their types. For example, "3" ===3 will be considered false (the types are different), while "3" ==3 (equality) will be considered true.
(11) FTP support: PHP 4.0 supports FTP. Typically, you would provide an interface for downloading a large file over a modem connection. However, if you really need it, you can use PHP.
(12) PHP4 new functions or enhanced functions: PHP 4.0 has added many new functions and also enhanced many existing functions. Here are some examples. array_count_values() eval() foreach() nclude() ob_end_clean() ob_end_flush() ob_get_contents() ob_start() strip_tags() unset()
(13) "here" printing: PHP 4.0's "Here" printing is the same as Perl is similar, although completely different. "Here" is a useful method for printing large-volume articles, such as HTML files, without missing any characters, such as table of contents tags.
(14) HTTP Session fallback system: A fallback system for HTTP Session management is implemented in PHP 4.0. By default, session identifiers are stored in cookies. If there is no cookie support or a cookie task fails, the Session identifier is automatically created and carried in the URL's query string.
(15) ISAPI support: PHP 4.0 can be used as a personalized ISAPI module as an IIS plug-in. This is more efficient than PHP 3.0, which runs as an external program.
(16) Memory: PHP 4.0 can use memory more efficiently, resulting in less memory consumption, mainly due to the implementation of reference counting technology.
(17) Member functions of other classes: In PHP 4.0, you can call member functions of other classes in the scope of the member function itself or in the global scope. For example, you can override a parent function with a child function and call the parent function in the child function.
(18) Multi-dimensional array: In PHP 4.0, data transmission using GET, POST, and Cookies supports multi-dimensional arrays.
(19) Personalized HTTP Session support: HTTP Session processing, including fallback system management, is implemented by its new library function in PHP 4.0. Handling Sessions in version 3.0 requires the use of PHPLIB and third-party library functions, which is much slower than having Sessions supported directly by PHP.
(20) Personalized Java support: PHP 4.0 supports interaction with java. This personalized Java support provides PHP with a simple and efficient tool for creating and using methods on Java objects.
21) Objects and number nested groups: PHP 4.0 implements more powerful objects and removes various syntax restrictions that existed in PHP 3.0. Objects can be nested within arrays and vice versa, depending on your needs.
(22) Object-oriented programming: PHP 4.0 provides extended functionality and new features for object-oriented programming and constructing classes and objects. PHP4 implements new technologies such as object overloading and reference technology.
(23) Object overloading support: Object overloading syntax allows third-party object-oriented class libraries to use the object-oriented features of PHP4 to access their own functions. A COM module using this feature has been implemented.
(24) Output buffering support: PHP provides a collection of output buffering functions. Output buffering support allows you to write functions that wrap functions around compressed buffers. Output buffering support in PHP4 allows HTML header information to be stored regardless of whether the HTML body is output. Header information ((header(), content type, and cookies) does not use buffering.
(25) Added PCRE library: PHP 4.0 includes a Perl-compatible regular expression (PCRE) library, together with the normal regex library PHP bindings. The split and replace PCRE functions are supported. There are some minor differences between PCRE and Perl regular expressions.
(26) PHP.ini file was redesigned in PHP4.0. Configuring PHP with PHP.ini is easier and more efficient. All files can be manipulated by Apache at runtime (under Apache) or by configuration directives added to the Windows registry (under Windows). Ground is supported in all relevant modules.
(27) Reference counting: PHP 4.0 provides a reference count for every value in the system, including resources. Once a resource is no longer referenced by any variable, it is automatically released to save memory resources. The most obvious example of utilizing this feature is a loop statement built into a SQL query. In PHP 3.0, each time it is recursed, another SQL result set repeatedly applies for memory. The memory occupied by these result sets is not released until the script is executed.
(28) Supports references: the value of a variable can be changed through references.
(29) Runtime binding of functions: PHP 4.0's runtime binding feature allows you to call them before they are declared, regardless of whether the declaration is later in the code or at runtime.
(30) Class runtime information: PHP 4.0 supports access to the following class information at runtime: the class name of an object, the class name of an object's parent class, and the name of the object's function.
(31) Server abstraction layer: Provides an enhanced SAPI (server API) interface to support web servers, which is an integral part of PHP 4.0. This server abstraction layer provides universal WEB server interface support, supports multi-threaded WEB servers, and provides transparent support for most WEB servers, including Apache, IIS (ISAPI), and AOL servers.
(32) Syntax highlight display: PHP 4.0 syntax highlight display allows developers to see the source code instead of the script. This feature is more effective than in PHP 3.0. It runs faster, performs better, and produces more compact HTML code.
(33) Changing the value of a variable by reference: PHP 4.0 supports variable assignment by reference. If the value of any one of the two "associated" variables is changed, the value of the other variable will also be changed. This is similar to pointer types in C.
(34) Variable references in reference strings: PHP 4.0 enhances variable references in reference strings. For example, this example is impossible to do in PHP 3.0: print "${a[0]->bingo}"
PHP’s rich support for databases is also one of the reasons for its rapid popularity. It supports The following databases or data files:
· Adabas D
· DBA
· dBase
· dbm
· filePro
· Informix
· InterBase
· mSQL
· Microsoft SQL Server
· MySQL
· Solid
· Sybase
· ODBC
· Oracle 8
· Oracle
· PostgreSQL
And on the Internet it It also supports a considerable number of communication protocols, including IMAP and POP3 related to email; network management system SNMP; network news NNTP; account sharing NIS; global information network HTTP and Apache server; directory protocol LDAP and other network Related functions.
In addition, web back-end CGI programs written in PHP can be easily ported to different operating systems. For example, if a website is first built on Linux, when the system load is too high, the entire system can be quickly moved to a SUN workstation without recompiling the CGI program. Faced with the rapid development of the Internet, this is the best choice for long-term planning.
A PHP instance
<font color="#000000"><code><font color="#000000"><br><font face="新宋体"><br><br><title>First program</title> <br><br><br></font><font face="新宋体"><font color="#0000bb"><?php <br></font><font color="#007700">echo </font><font color="#dd0000">"hello, worldn"</font></font><font face="新宋体" color="#007700">;<br></font><font face="新宋体"><font color="#0000bb">?><br></font><br></font></font>
First program

echo "hello, worldn";
?> http://www.bkjia.com/PHPjc/446898.htmlwww.bkjia.com
true
http: //www.bkjia.com/PHPjc/446898.html
TechArticlePHP, a nested abbreviation name, is the English "Hypertext Preprocessing Language" (PHP: Hypertext Preprocessor) abbreviation. PHP is an HTML embedded language. PHP is quite similar to Microsoft's ASP...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP 4. Zend_PHPNext article:PHP 4. Zend_PHP