For beginners in PHP, when using the global keyword, you may find that a variable outside of a function within a function, in some cases, does not output the variable correctly (that is, the global variable is invalid). Let's look at a simple and
PHP Data typePHP supports eight original types (type).
4 Kinds of scalar types:String (String), Integer (integer), float (floating-point type, also double), Boolean (Boolean)Two types of composite:Array (array), Object (objects)Two special
The discovery today of the need to call subclasses in the parent class has never been used before and is also possible through practice. Examples are as follows:
The code is as follows
Copy Code
/*** Parent class calling
What is the reference?
Referencing in PHP means accessing the contents of the same variable with a different name. This is not like a C pointer, but instead, the reference is a symbolic table alias. Note that in PHP, variable names and variable
Object oriented thought
Object-Oriented programming (Object-oriented Programming,oop) is a programming paradigm, and colleagues are also a method of program development. It encapsulates the program and data as the basic unit of the program to
Usage of references in PHP:
1. Reference assignment of variables: $a = & $b
2. Reference parameter passing when function call
1 early PHP is a variable that passes a reference type by & symbol when it is invoked, for example: Func (& $arg);
2
GZIP (Gnu-zip) is a compression technique. The page size can be turned into 30% or smaller after gzip compression. This way the user will feel very happy when browsing!To achieve the GZIP compression page requires a common browser and server support,
How PHP reads files
The file_get_contents () function reads the entire file into a string.
Example
The code is as follows
Copy Code
Echo file_get_contents ("test.txt");?>
Output:
This was a test file with
By default, the PHP instruction MAGIC_QUOTES_GPC is on, and it automatically runs Addslashes () for all get, POST, and COOKIE data. Do not use Addslashes () on strings that have been escaped by MAGIC_QUOTES_GPC, because this can result in a double
/*Session Brief descriptionSession is a server global variable, commonly used in the user login, shopping cart instances, used in some security requirements of the application of high.Session also has many advantages, such as easy to control, can be
/*1. Embedding Method:Similar to the ASP
2. Reference documents:There are two ways to refer to a file: Require and include.Require use methods such as: Require ("myrequirefile.php");This function is usually placed at the top of the PHP program,
The code is as follows
Copy Code
$DM = ' www.111cn.net ';$ip = gethostbyname ($DM);echo gethostbyaddr ($IP);Echo $ip;
Two output results are the same,/*About gethostbyname syntax
String gethostbyname (String $hostname)
Method One
The code is as follows
Copy Code
Preg_match_all ('/[]* (check user) []*/i ', $string, $matches);
Method Two
The code is as follows
Copy Code
Preg_match_all ('/check
function Outpege ($ps tutorial, $page){$ps Cumulative number of information $page the current page number $max the maximum number of lists $min the minimum value of the list$max = ($page >= 5)? $page +5:10;if ($max > $ps) $max = $ps;$min = ($page-5);
Look at an example
The code is as follows
Copy Code
Class Cart { var $items; //Shopping cart Items //Put $num $a Rtnr into the car function Add_item ($ARTNR, $num) { $this->items[$artnr] + =
There are many methods for paging in Smarty.1. Use the pagination plug-in of Smarty, such as Pager, pagnition, and sliding_page. However, these plug-ins are not very good, and almost all of them have bugs.If you are interested in trial and
// The English verification code is relatively simple. Do not perform hex processing. Simply use the color value and you will be OK. IfSession_start ();Function rand_create (){ // Notify the browser that a PNG image will be outputHeader
The method is to use a matrix. The Chinese character is composed of two ascii characters, one high-bit code and one low-bit code. The boundary is 128-264 64-128, respectively.Each Chinese character Pinyin can contain a maximum of 8 characters, and
Nginx 0.7.x + php Tutorial 5.2.10 (fastcgi) build a web server that is 10 times better than apache (version 5th)Original article addressHttp://blog.s135.com/nginx_php_v5/Because the compilation process and wait time are cumbersome, I wrote a fully
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