Let's look at a piece of code first:
〈?php
for ($i =10; $i 〉0; $i--)
{
echo $i;
Flush ();
Sleep (1);
}
?〉
According to the PHP manual, this function sends all output from the current program to the user's browser.
The above code, should be output
PHP's control structure is mostly the same as other mainstream languages, such as C,java.
Here are some of the different and often-tested details:
1> alternative syntax for Process Control (Pascal style)
Mainly used in If,while,for,foreach and
Copy Code code as follows:
intercepts the string length. Supports Utf-8 and gb2312 encodings. If for gb2312, first turn it into Utf-8, intercept on utf-8 basis and then convert back
function cut_string ($str, $from =1, $length =10, $code = '
The constants defined in PHP5 are different from the method that defines the variable, and you do not need to add the $ modifier. Const PI = 3.14; That's OK.
Constant names that are defined using const are generally capitalized, which is a
In this section, let's take a look at how to create a class and object in PHP.
1. Create Class
In PHP, create a class similar to the one in C#/java, gossip less, and show you the simplest example:
Copy Code code as follows:
class
This example describes the form validation classes that are encapsulated in PHP. Share to everyone for your reference, specific as follows:
More about PHP Interested readers can view the site topics: "PHP Design Security Course", "PHP
Recent projects need to chat on the basis of the new red envelope function, demand: imitation micro-letter (excluding messages), but only use the balance of red envelopes. So many times using the micro-letter red envelopes to understand the various
This example describes the PHP cloud printing class. Share to everyone for your reference, specific as follows:
A project needs hundreds of computers have a printing function, is intended to use a network printer, and later found that there is no
This article describes the PHP Thief program Design and implementation methods. Share to everyone for your reference, specific as follows:
In fact, I have always wanted to do a connotation of the image of the site, the previous idea is to do a CMS,
page.php
Copy Code code as follows:
/**
* * General PHP Paging class. (Imitation Google style)
* * Just provide a total number of records and two parameters per page display. (Detailed use instructions are attached.)
* * without
Development environment: CentOS + Nginx + PHP + MySql + phpmyadmin
In the use of phpMyAdmin SQL database import, often need to upload large SQL data files, and at this time will often encounter Nginx error: 413 Request Entity Too Large.
To solve
When we write a program, no matter how cautious, mistakes are always unavoidable. These errors usually confuse the PHP compiler. If developers cannot understand the implications of compiler error messages, these are not only useless, but often
The Seventh day study goal: learns the session the use
The role of a lot of sessions, the most use is the site within the page variable transfer. At the beginning of the page we want to session_start ();
Then you can use the session variable, for
5. How to instantiate an object
As we said above, the object object is the unit of the Object-oriented program, but the object is also instantiated by the class, since
Our class will declare that the next step is to instantiate the object.
When the
Several variants of a For loop statement in PHP
/google 的广告条-->
The for statement can be said to be PHP (but also many languages) of the loop control part of the most basic statement of the execution of the
This example is under Wiondws XP
IIS5.1
php5.2.1 (Zip)
MySQL5.0.37
phpmyadmin2.10.0.2
ZendOptimizer-3.2.6
Installation and configuration of
installation of IIS
1 Install the Windows XP SP2 system installation CD in the optical drive
2 in Control
Copy Code code as follows:
'/*=========================================================================
' * Intro PHP installation script, you have to do is: Save this file and to install the PHP folder together (not in the C-packing directory)
In PHP There are two sets of regular expression libraries. A set is provided by the Pcre (Perl compatible Regular Expression) library. The Pcre library implements pattern matching for regular expressions using the same syntax rules as Perl, using
Generally speaking, a website that provides the member registration must collect the user's password, how to save the user's password is a problem. Of course we can't store passwords in the database in plaintext, because in this case, the general
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