1.PHP (foreign name: Php:hypertext Preprocessor, Chinese name: "Hypertext Preprocessor") is a common open source scripting language. The grammar absorbs the C language, Java and Perl features, is conducive to learning, widely used, mainly for the field of web development. PHP's unique syntax mixes the syntax of C, Java, Perl, and PHP's own creation. It can execute Dynamic Web pages more quickly than CGI or Perl. Dynamic pages made in PHP are compared to other programming languages, and PHP is executed in HTML (an application under the standard Universal Markup Language), which is much more efficient than CGI, which generates HTML markup entirely; PHP can also execute post-compilation code, Compilation can achieve encryption and optimize code execution, making code run faster.
Chinese name hypertext preprocessor Foreign name Php:hypertext preprocessor programming Paradigm object-oriented, imperative programming designer Rasmus Lerdorf maintenance The PHP Group latest version PHP 5.6.0 2014)
(10) Type check: PHP 4.0 supports the same operator for evaluation of type checking: = = = (3 equals operator, identity calculation) for checking between two values and their types. For example, the ' 3 ' ===3 will be considered false (the type is different), while 3 ==3 (equal judgment, no comparison type) will be considered true.
Environment configuration Edit Windows Vista or later for software requirements (latest version), Apache or IIS 6+ or Nginx installation process installs Apache 1.3.19 into the C:\Web\apache\ directory.
Unzip the PHP 4.0.5 into the C:\Web\php\ directory. Install the MySQL 3.23.38 into the C:\Web\mysql\ directory.
Copy the C:\web\php\php4ts.dll file to the C:\WINNT\system32\ directory.
Copy the C:\web\php\php.exel file to the C:\WINNT\ directory.
Copy the C:\web\php\php.ini-dist file to the C:\WINNT\ directory and rename the php.ini-dist to php.ini.
Run C:\web\apache\apache\apache.exe-i–n run C:\Web\mysql\bin\mysqld-nt.exe--install edit C:\WINNT\php.ini find "Extension_ dir =./"field, change it to Extension_dir =" C:\myphp\php\extensions ". Edit C:\Web\apache\Apache\conf\httpd.conf Find the "#BindAddress *" field and change it to BindAddress127.0.0.1. (If the host has a fixed IP address, the host IP address is changed here.) such as Bindaddress 211.101.152.106), find the "ServerName" field and change it to ServerName localhost. (If the host has a fixed hostname, the host name is changed here.) such as ServerName bn001).
Find the "scriptalias/cgi-bin/" c:/web/apache/apache/cgi-bin/"" field and add the scriptalias/php/"c:/web/php/" below it. Find the "# and for PHP 4.x,use:" field after which it was added: 12addtypeapplication/x-httpd-phpactionapplication/x-httpd-php "c:/web/php/ Php.exe "Find" #LoadModule usertrack_module modules/mod_usertrack so "field, LoadModule php4_module c:/web/php/sapi/ Php4apache.dllunix Required software php-3.0.14-win32.zip;php-3.0.14-win32.zip;mysql-shareware-3.22.32-win.zip all software installed in/ export/home/guoj/, also available in other directories.
Installing mysql12345678910111213141516171819202122232425262728gzip-dcmysql-3.22.30.tar.gz|tarxvf-cdmysql-3.22.30./ Configure-prefix=/export/home/guoj/mysqlmakemakeinstallscripts/mysql_install_dbcd. /mysql/binbin/safe_mysqld& installation phpapachegzip-dcapache_1.3.11.tar.gz|tarxvf-gzip-dcphp-3.0.11.tar.gz| Tarxvf-cdapache_1.3.11./configure-prefix=/export/home/guoj/wwwcd. /php-3.0.11./configure-with-apache=/export/home/guoj/apache_1.3.11-with-mysql=/export/home/guoj/ Mysql-enable-track-varsmakemakeinstallcd. /apache_1.3.11./configure--prefix=/export/home/guoj/www--activate-module=src/modules/php3/ Libphp3.apmakemakeinstallcd. /PHP-3.0.11CD. /php3.ini-distphp3.iniviphp3.ini modifying php3.inidoc_root=/export/home/guoj/www/htdocs/extension_dir=/export/home/ Guoj/php-3.0.11/extension=php3_mysql.dllcpphp3.ini/usr/local/lib/php3.inivi. /www/conf/httpd.conf Add the following sentence: 1234OptionsFollowSymLinks
Allowoverridenone
.. /www/bin/apachectlstart
Other aspects of editing
PHP's extensive support of the database is also one of the reasons for its rapid popularity, which supports the following databases or data files:
Adabas, D, DBA, DBase, dbm, Filepro, Informix, InterBase, MSQL, Microsoft SQL Server, MySQL, Solid, Sybase, Oracle, PostgreSQL
And on the Internet it also supports a considerable number of communication protocols (protocol), including e-mail-related IMAP,POP3, network management system SNMP, Internet news NNTP, account sharing NIS, global information Network HTTP and Apache Server, directory protocol LDAP and other network-related functions.
In addition, the Web back-end CGI program written in PHP can be easily ported to different operating systems. For example, a Linux-based Web site can quickly move the entire system to a SUN workstation without recompiling the CGI program when the system is overloaded. Facing the fast-growing Internet, this is the best choice for long-term planning.
Related grammar and concepts
PHP supports eight primitive types.
Four scalar types: Boolean (Boolean) integer (integer) float (floating-point, also Double) string (string)
Two composite types: Array (array) object (object)
Finally, there are two special types: resource (Resource) NULL
To ensure the readability of the Code, this manual also describes some pseudo-types: mixed, number, callback
Syntax (the PHP code boundary character is ignored in the example):
There are three kinds of syntax for annotations:
Comment This is a single-line comment
/*comment*/This is a multi-line comment
#comment这个是脚本类型注释, seldom used
Basic Structure Control Statements:
Branch structure (select structure)
if (condition) {
Statement
}
if (condition) {
Statement
}else{
Statement
}
if (condition) {
Statement
}elseif (condition) {
Statement
}
Multi-branch structure
Switch ($ variable) {
Case ' value ':
Statement
Break
Case ' Value 2 ':
Statement
Break
Default
Statement
}
Loop structure
while (condition) {
Statement
}
do{
Statement
}while (condition);
for (initialize; judge; change) {
Statement
}
Array traversal dedicated LOOP statement
foreach ($Arrayas $value) {
Echo$value;
}
foreach ($Arrayas $key=> $value) {
Echo$key;
Echo$value;
}
A PHP instance:
The concatenation of string types in 12//php is not the same as most other uses of the "+" operator, but instead uses "." Number arithmetic
"." For object properties and method calls in a generic language operator, use "= =" with the structure of the C language
PHP support for object-oriented
The concept of object-oriented programming:
Different authors may disagree, but an OOP language must have the following:
1. Abstract data types and information encapsulation
2. Inheritance
3. polymorphic
In PHP, the encapsulation is done through a class:
In OOP classes, large double hump nomenclature is usually used, and the first letter of each word is capitalized
classsomething{
Scope modifier: Public, private, protected protected;
The name of the property is generally in full lowercase
private$x=null;//in programming recommendations, the properties used internally should give the private modifier, and then the value is assigned by the method
The name of the method is generally named by the small hump, the first word is all lowercase, the remaining words are capitalized
Because PHP does not automatically use $this for variables, you must actively add the $this pseudo-variable to point to the manipulated object
Publicfunctionsetx ($v) {
$this->x= $v;
}
Publicfunctiongetx () {
return$this->x;
}
}
Of course you can define your preferences, but it's better to keep a standard, which is more effective. Data members are defined in a class using the "var" declaration, which is not typed until the data member is assigned a value. A data member can be an integer, an array, an associated array (associative array), or an object. method is defined as a function in a class, you should use $this->name when accessing a class member variable in a method, otherwise it can only be a local variable for a method.
Use the new operator to create an object:
1
$obj =newsomething;
Then you can use the member function to pass: $obj->setx (5);
$see = $obj->getx ();
Echo$see;
In this example, the SETX member function assigns 5 to the object's member variable x (not the Class), and then Getx returns its value 5. It is not a good OOP habit to access data members by way of a class reference like $obj->x=6. I strongly recommend accessing member variables through methods. If you consider the member variable to be non-processing and use the method only through the object handle, you will be a good OOP programmer. Unfortunately, PHP does not support declaring private member variables, so bad code is also allowed in PHP. Inheritance is easy to implement in PHP, as long as the extends keyword is used.
classanotherextendssomething{
Private$y;
Publicfunctionsety ($v) {
$this->y= $v;
}
Functiongety () {
return$this->y;
}
}
The objects of the "another" class have all the data members and methods of the parent class (Something), plus their own data members and methods.
You can use
$obj 2=newanother;
$obj 2->sety (5);
Echo$obj2->gety ();
PHP only supports single inheritance, so you cannot derive new classes from two or more of the two classes. You can redefine a method in a derived class, and if we redefine the Getx method (method override) in the "Another" class, we cannot use the Getx method in "Something". If you declare a data member in a derived class that has the same name as implementation, it will "hide" the data members of the base class when you process it.
You can define constructors in your class. A constructor is a method that has the same name as a class, and is called when you create an object of a class, for example:
classsomething{
Private$x=null;
The new version of the constructor discards the use of the class name and uses __construct () uniformly.
Publicfunction__construct ($x) {
$this->x= $x;
}
Publicfunctionsetx ($v) {
$this->x= $v;
}
Publicfunctiongetx () {
return$this->x;
}
Destructors
Publicfunction__destruct () {
}
}
So you can create an object by:
1
$obj =newsomething (6);
The constructor automatically assigns a value of 6 to the data variable, x. Constructors and methods are normal PHP functions ("__" two underscores, magic methods), so you can use the default parameters.
Publicfunction__construct ($x = "3", $y = "5") {
}
Then: $obj =newsomething ();//x=3andy=5
$obj =newsomething (8);//x=8andy=5
$obj =newsomething (8,9);//x=8andy=9
The default parameter uses C + +, so you can't ignore the value of Y, and give X a default parameter, which is assigned from left to right, and if the passed parameter is less than the required parameter, the default parameter is used.
When an object of a derived class is created, only its constructor is called, the constructor of the parent class is not called, and if you want to call the constructor of the base class, you must call it with Parent::__construct () in the constructor of the derived class. You can do this because all of the parent classes in the derived class are available in methods.
classanotherextendssomething{
Publicfunction__construct () {
Parent::__construct (5,6);//Display Call base class constructor
}
}
A good mechanism for OOP is to use abstract classes. Abstract classes are not instantiated and can only be supplied to a derived class interface. Designers often use abstract classes to force programmers to derive from base classes, which ensures that new classes contain some expected functionality. There is no standard method in PHP, but: if you need this feature, you can define the base class and add a "die" call after its constructor, so that the base class is not instantiated, and after each method (interface) with a "Die" statement, so, If a programmer does not overwrite a method in a derived class, an error is raised. And because PHP is untyped, you might want to make sure that an object is derived from your base class, then add a method in the base class to the identity of the literal class (returning an Identity ID), and verify the value when you receive an object parameter. Of course, if a bad evil programmer overrides this method in a derived class, this method does not work, but the general problem is more on lazy programmers than the evil programmer.
Of course, it's good for the base class to be impossible for programmers to see, as long as the interface is printed out to do their job. PHP 5 introduces the concept of destructors, similar to other object-oriented languages such as C + +. Destructors are removed when all references to an object are deleted or executed when an object is explicitly destroyed. [3]
Overloading (unlike overrides) is not supported in PHP because PHP is a weakly typed language. In OOP, you can overload a method to implement two or more methods with the same name, but with different numbers or types of arguments (this depends on the language). PHP is a loosely typed language, so it does not work with type overloading, but overloading with different number of parameters does not work.
Sometimes overloading constructors in OOP is good, so you can create objects (variable functions) in different ways. The trick to implementing it in PHP is:
classmyclass{
Publicfunctionmyclass () {
$name = "Myclass". Func_num_args ();//This function returns the number of arguments passed over
$this-$name ();//A variable function is used here, called with the value of the variable as the name of the function
}
PublicfunctionMyclass1 ($x) {
Code
}
PublicfunctionMyclass2 ($x, $y) {
Code
}
}
By additional processing in the class, using this class is transparent to the user:
$obj 1=newmyclass (' 1 ');//Will call Myclass1
$obj 2=newmyclass (' 1 ', ' 2 ');//Will call Myclass2
Sometimes this is very useful.
Polymorphic
Polymorphism is the ability of an object to determine the method of which object to invoke, depending on the passed object parameters at run time. For example, if you have a figure class, it defines a draw method. and derive the circle and rectangle classes, in which you override the Draw method, you may also have a function that expects to use a parameter x, and can call $x->draw (). If you have polymorphism, calling which draw method depends on the type of object you pass to the function.
Polymorphism in an interpreted language like PHP (imagine a C + + compiler generating such code, which method should you call?) You also don't know what type of object you have, well, it's not the point, it's very easy and natural. So PHP certainly supports polymorphism.
classcalc{
Functionnicedrawing ($x) {//Assume this is a method of the Board class
$x->draw ();
}
}
classcircle{
Publicfunctiondraw () {
echo "drew a circle";
}
}
classrectangle{
Publicfunctiondraw () {
echo "drew a rectangle";
}
}
$board =newcalc;
$obj =newcircle (3,187);
$obj 2=newrectangle (4,5);
$board->nicedrawing ($obj);//Will call the draw method of circle
$board->nicedrawing ($obj 2);//Will call Rectangle's Draw method
Object-oriented Programming with PHP
Some "purists" (purists) may say that PHP is not a true object-oriented language, which is true. PHP is a mixed language, you can use OOP, or you can use traditional procedural programming. However, for large projects, you might want to use pure OOP in PHP to declare classes, and only use objects and classes in your project.
As projects grow larger, using OOP can be helpful, and OOP code is easy to maintain, easy to understand and reuse. These are the foundations of software engineering. Applying these concepts to Web-based projects is the key to future site success.
Advanced OOP Technology
After reading the basic OOP concepts, I can show you more advanced techniques:
Serialization (serializing)
While PHP does not support persistent objects, permanent objects in OOP are objects that can hold state and functionality in references to multiple apps, which means having the ability to save objects to a file or database, and to load objects later. This is called the serialization mechanism. PHP has a serialization method that can be called through an object, and the serialization method can return a string representation of an object. However, serialization saves only the member data of the object and does not include the method.
In PHP4, if you serialize an object into a string $s and then release the object, and then deserialize the object to $obj, you can continue to use the object's Method! I do not recommend this because (a) there is no guarantee in the documentation that this behavior will still be available in later versions. (b) This may lead to a misunderstanding when you save a serialized version to disk and exit the script. When you run the script later, you cannot expect the object's methods to be there when deserializing an object, because the string representation does not include the method at all.
In summary, PHP serialization is useful for saving member variables of an object. (You can also serialize related arrays and arrays into a file).
Example
$obj =newclassfoo ();
$str =serialize ($obj);//save $str to disk
$obj 2=unserialize ($STR);//After several months//loading str from disk
You restored the member data, but did not include the method (according to the document). This leads to access to member variables only by similar use of $obj2->x (you have no other way!). The only way, so don't try it at home.
There are some ways to solve this problem, I keep it, because they are too bad for this concise article. I would be delighted to welcome the full serialization feature in subsequent versions of PHP.
Using classes for data storage PHP and oop a very good thing is that you can easily define a class to manipulate something, and you can invoke the appropriate class whenever you want to use it. Suppose you have an HTML form that allows users to select a product by selecting the Product ID number. In the database has the product information, you want to display the product, show its price and so on. You have different types of products, and the same action may have different meanings for different products. For example, displaying a sound might mean playing it, but for other kinds of products it might mean displaying a picture in the database. You can use OOP or PHP to reduce coding and improve quality:
Define a product's class, define the method it should have (for example: Display), and then define the classes for each type of product, from the product class to come out (Sounditem class, Viewableitem class, etc.), covering the methods in the product class so that they act as you think.
Name the class according to the type of each product in the database, a typical product table may have (id,type,price,description, etc. fields) ... Then in the processing script, you can remove the type value from the database and instantiate an object named type:
$obj =new$type ();
$obj->action ();
This is a very good feature of PHP, you can not consider the type of object, call $obj display method or other methods. With this technique, you don't need to modify the script to add a new type of object, just add a class that handles it.
This is a powerful feature, as long as you define the method without considering the types of all the objects, implement them in different ways, and then use them in the main script for any object, no if...else, no two programmers, only happy.
Do you agree that programming is easy and maintenance is cheap and reusable is true?
If you manage a group of programmers, assigning jobs is easy, and everyone can be responsible for one type of object and the class that handles it.
Internationalization can be achieved through this technology, according to the user's chosen language field to apply the corresponding class can be, and so on.
Copy and Clone
When you create a $obj object, you can copy the object through the $obj2= $obj, and the new object is a copy of the $obj (not a reference), so it has a $obj state at that time. Sometimes, you don't want to, you just want to create a new object like the Obj class, you can call the class's constructor by using the new statement. It can also be implemented in PHP by serialization, and a base class, but all other classes are derived from the base class.
Enter hazardous areas
When you serialize an object, you get a string of some format, and if you're interested, you can tune it, where the string has the name of the class (too good!). ), you can take it out, like this: $herring =serialize ($obj);
$vec =explode (': ', $herring);//To: Splits a string into an array for an identifier
$nam =str_replace ("\", "', $vec [2]);
So suppose you create a "Universe" class and force all classes to be extended from Universe, you can define a clone method in Universe, as follows:
classuniverse{
Cloning in the new PHP version (__clone ()) is a magic method, don't confuse this method.
Functionclone () {
$herring =serialize ($this);
$vec =explode (': ', $herring);
$nam =str_replace ("\" "," ', $vec [2]);
$ret =new$nam;
Return$ret;
}
}//Then
$obj =newsomething ();//Extended from Universe
$other = $obj->clone ();
What you get is a new object of the Something class, which is the same as using the new method, which calls the constructor to create the object. I don't know if this is useful for you, but the Universe class can know the name of the derived class as a good experience. Imagination is the only limit.
Template engine
Smarty:smarty is characterized by compiling the template into a PHP script and then executing the scripts. Very soon, very convenient.
Heyes template Class: A very easy-to-use but powerful and fast templating engine that helps you separate page layouts and designs from your code.
Fasttemplate: A simple variable interpolation template class that parses your template and separates the value of the variable from the HTML code.
Shellpage: An easy-to-use class that allows your entire site layout to be based on template files and modify the template to change the entire site.
STP Simple template Parser: An easy, lightweight and easy-to-use templates analysis class. It can assemble a page from multiple templates and output the resulting page to a browser or file system.
OO class: An object-oriented template class that you can use in your own program.
Simpletemplate: A template engine that can create and structure Web sites. It can parse and compile templates.
Btemplate: Short but fast template classes that allow you to detach PHP logic code from HTML-decorated code.
Savant: A powerful and lightweight pear compatible templating system. It is non-compiled and uses the PHP language itself as its template language.
Ets-easy templates System: Template systems that can use the exact same data to reorganize templates.
Easytemplatephp: A simple but powerful templating system for your site.
Vlibtemplate: A fast, versatile templating system that contains a cache and Debug class.
Avantemplate: A multi-byte secure template engine that consumes very little system resources. It supports variable substitution, and content blocks can be set to show or hide
Grafx Software's fast template: a modified version of the fast template system that includes caching features, debug consoles, and silence removal as an assignment block.
Templatepower: A fast, simple, powerful template class. The main functions are nested dynamic block support, block/file containing support and display/Hide unassigned variables.
Tagtemplate: The functionality of this library is designed to use template files while allowing you to retrieve information from HTML files.
Htmltmpl:templating: A template engine for Python and PHP. It is intended for Web application developers who want to decouple code and design in their projects.
PHP class for parsing dreamweaver templates: A simple class that parses the Dreamweaver template and is used in Gallery 2 and WordPress custom modules.
Minitemplator: A compact template engine for HTML files. It has a simple syntax for template variables and block definitions. Where blocks can be nested.
Layout Solution: Simplifies website development and maintenance. It has common variables and page elements so you don't have to repeat the page layout work.
Cached Fast Template: It has been incorporated into fasttemplate, allowing you to cache template files and even cache different specifications on detached block content.
Tinybutstrong: A template engine that supports Mysql,odbc,sql-server and ADODB. It consists of 7 methods and two properties.
Brian Lozier's PHP based template engine: only 2 K size, very fast and object-oriented design.
Wact: A template engine that separates the code from the design.
Phptal: A xml/xhtml Template Library under PHP.
Rong_view_wudimei:wudimei developed the Rong Framework template engine, which is similar to Smarty, with the advantage that the speed is fast, the disadvantage is that the template label is less, but enough.
Framework Introduction thinkphp
Thinkphp is a free, open-source, fast, simple object-oriented, lightweight PHP development framework that was launched in early 2006 to follow the Apache2 open source agreement and was created for Agile Web application development and simplified enterprise application development. Since its inception, thinkphp has been adhering to the principle of simple and practical design, while maintaining excellent performance and to simplify the code, but also focus on ease of use. And with many original features and characteristics, with the active participation of community teams, continuous optimization and improvement in ease of use, scalability and performance, has grown into one of the most advanced and influential Web application development frameworks in the country, and numerous typical cases ensure stable use for commercial and portal-level development.
PHP Authentication Level
The PHP course is comprised of three sections of beginner (IFE), Intermediate (IPE), and Advanced (IAE).
IFE is the abbreviation for Index front-end engineer, the exponent front-end engineer means.
IPE is the abbreviation for index PHP Engineer, which means an exponential PHP engineer.
IAE is the abbreviation for Index architecture/advanced engineer, which means: Exponential Senior/Architecture engineer.
PHP Security
PHP is really just a module function of Web server, so the security of Web server should be ensured first. Of course, the Web server to be secure and must be first to ensure that the system security, so far away, endless. Common Web security vulnerabilities include: injection attacks, cross-site attacks, server vulnerabilities, etc., the corresponding detailed explanation, see: Extended reading "web Security -2010_owasp_top10", here is a very detailed explanation.
Advantages of PHP learning process and methods
PHP's syntax is similar to c,perl,asp or JSP. For those who are more familiar with one of these languages, PHP is too simple. Conversely, if you know more about PHP, you will be very easy to learn from several other languages. You only have a short time to master the core language features of PHP, you may already know HTML very well, even you already knew how to use the editor design software or manual to make good-looking Web site. Because PHP code can be easily added to your site, while you design and maintain the site, you can easy to join PHP to make your site more dynamic features.
Database connection
PHP can be compiled into functions that are connected to many databases. PHP and MySQL is a great combination, if you add Apache server, it is quite perfect. You can also write your own peripheral functions to access the database indirectly. With this approach, you can easily change the encoding to accommodate such changes when you replace the database you are using. Phplib is the most common set of base libraries that can provide general transaction needs.
Scalability
As I said earlier, PHP has entered a period of rapid development. It may be difficult for a non-programmer to extend additional functionality to PHP, but it is not difficult for a PHP programmer.
PHP Scalability
Traditionally, the interaction of Web pages is achieved through CGI. The CGI program's scalability is not ideal because it opens a separate process for each of the running CGI programs. The solution is to use the language that is often used to write CGI programs
Notepad Saving php file considerations
Notepad Saving php file considerations
The interpreter is compiled into your Web server (e.g. mod_perl,jsp). PHP can be installed in this way, although few would like to install it in a CGI manner. Built-in PHP can be more scalable.
PHP Free Installation
PHP source Code Package installation version: This version is suitable already has its own independent website domain name, the website space Specialized website constructs the user. The use of the method is still simple, only three steps:
First, to the official website: Download the latest version of the PHP source code package installation version, unzip the download file, upload all of the content to your PHP-supported web space
Second, change the file attributes, the root directory under the php suffix of the file and "/include/domain.php" and "/attachments" and "/data" folder and all the file properties under the folder to "readable", "writable", "executable", usually " 755 ".
Third, open your Web site root directory, the system will automatically run the Setup installer, follow the instructions to the next step.
Friendly tip: When you download our software and see this note, then you must be on the enterprise website construction has certain needs or you are a website building technology learners.
File format
For files that contain only PHP code, we will ignore "?>" at the end of the file. This is to prevent extraneous spaces or other characters from affecting the code.
For example:
$foo = ' Foo ';
Indentation should reflect the logical results of the code, use four spaces as much as possible, and Disable Tab tab, as this guarantees flexibility across the client programmer software.
For example: if (1== $x) {
$indented _code=1;
if (1== $new _line) {
$more _indented_code=1;
}
}
Variable assignment recommendations maintain equal spacing and arrangement.
For example: $variable = ' demo ';
$var = ' Demo2 ';
Each line of code should be within 80 characters and no longer than 120 characters. Because the Linux read-in file is generally listed in 80 units, that is, if a line of code more than 80 characters, then the system will pay extra instructions for this. While this may seem like a minor problem, it is a standard that deserves attention and adherence to the perfect programmer.
No extra spaces are allowed at the end of each line.
PHP file Notepad edit garbled problem
In general, the Notepad editor, when you finish editing and saving the file, has its default encoding of ANSI, Chinese. But more time, PHP in the language environment set language most of utf-8, directly save and use for Apache and other http-server after parsing will appear garbled.
For this reason, you should note that when you finish editing with Notepad, you can save the file in a "Save as" mode and select "All Files" in the "file type" and the encoding is consistent with the specified language of the file. [4]
Arithmetic operators
The operators of PHP include arithmetic operators, assignment operators, comparison operators, and logical operators. [5]
Arithmetic operators:
Add, subtract, multiply, divide, take the mold (take the remainder)
+ 、-、 *,/,%
Assignment operators: (The following explanations differ in many books)
Assignment, assignment, minus assignment, multiply assignment, addition assignment, hyphenation assignment
=, + =,-=, *=,/=,. =
Bitwise operators:
bitwise AND, bit or, bit also or, bitwise non, left shift, right shift
&, |, ^, ~, <<, >>
Comparison operators:
Equal, full equal, not equal, not wholly equal to, greater than, less than, greater than or equal to, less than or equal to
= =, = = =, = = (<>),!==, >, <, >=, <=
Logical operators:
Logical and logical OR logical, logical, OR
&&, | | 、!、 XOR
String operators:
. Connect two strings
Lily is cold
Links: Http://www.jianshu.com/p/356737ecea38
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
PHP (Hyper-text preprocessor)