The application of regular expressions in PHP
In PHP applications, regular expressions are mainly used to:• Regular match: matches the corresponding content according to the regular expression• Regular substitution: matches content according to
with the rapid development of PHP, more and more people use it inPHP arrays
The learning excerpt section learns the basics of the creation of PHP arrays and the display of the array elements. Need to learn more about the operation of the PHP array.
See Ucenter when there is a function call_user_func, think not its solution, because I thought it is the function of their own definition, the results can not be found everywhere, and then Baidu a bit to know Call_user_func is built-in function
The
Code reuseImprove development efficiency and reduce costs by reusing existing codeInclude () and require () functions. "Interview Frequently asked"Require () imports a file during preprocessing, such as pasting the file into a function where it is
switch statement and have the sameAn expression
a series of IF statements are similar. In many cases it is necessary to compare the same variable (or expression) with many different values and execute different code depending on which value it
before removing the null value of the array is strongly write foreach or while, using these two syntax structure to delete empty elements in the array, the simple code is as follows:
And self-feeling is pretty good, but this is not high efficiency
First, sequential control:
This is done by default from left to right, from top to bottom in a simple order. Uncontrolled process.
Second, branch control:Single branch, dual branch, multi-branch;Single-branch Syntax:
$age =17;if ($age
Two-branch
First, will the unset in PHP actually release memory?
First let's look at an example:
Var_dump (Memory_get_usage ()); $a = "laruence"; Var_dump (Memory_get_usage ()); unset ($a); Var_dump (Memory_get_usage ()) ;
Output (on different PCs, may vary
conditional control statements mainly have if, if...else, ElseIf and switch four, whileloop is the simplest of the PHP loop, use the Break/continue statement to jump out of the loop.
1. If
if () { statement;} else if { statement;} elseif {
The introduction of templates with include is a very flexible layout scheme.
But because the official tutorial is not too clear, often cause misunderstanding. So say two sentences:
1. First the difference between the template that the include
A logical operator is nothing more than a logical operation of a value. (&&) or (| | These two operators can speed up the PHP code in the program.
First look at a piece of code:
Why does it produce such a result? If we follow the usual method, we
First look at the print results and return values for the following methods:
public static void Main (string[] args) {System.out.println ("return value:" + TestResult ());} public static Boolean TestResult () {for (int i=1; i Start:" + i); if (i =
/* Here to explain because I am more lazy blog related article content more is to A book Code collation and simple annotations to facilitate their future review and reference, interested in the relevant content of the beginner's friends suggest
Objective
Oop
Learning PHP for a long time, today to summarize the abstract classes in PHP and abstract methods/static properties and static methods/php in the simple interest mode (single-state mode)/serialization and crossdress (serialization
The difference between "turn" switch and ifIf you are purely comparing numbers or characters, it is recommended that you use switch because it takes the value of the variable once in the first switch bracket, and then compares the value to the case
In the morning to write a PHP program, because to deal with a large amount of data, so have to consider the issue of running time. Then in the calculation of the weight of each item encountered a problem, in the consideration should be used
@ operatorValid only for expressions. A simple rule for beginners is that if you can get a value from somewhere, you can precede it with the @ operator. For example, you can put it in variables, functions and include () calls, constants, and so
What is a php reference?
The reference in php means: Different names access the same variable content . PHP references (that is, the variables or functions, objects, etc. are preceded by the & symbol). Does it look like you're picking up orders,
This article mainly introduces PHP ternary operation of 2 code examples, the need for friends can refer to the following
First, we now look at a simple example:
The code is as follows:
The above example, first determine whether a $ A is 1 if
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