Introduction
Normally our foreach can print each key in a one-dimensional array in order and value, but if it is a multidimensional array it needs to be looped in a nested loop, or recursively, but these are not flexible enough because, in the
Mod_gzip is an Apache module whose function is to compress static HTML pages using gzip, and the browser that adheres to the IETF standard can accept gzip encoding (IE, Netscape, etc.). Mod_gzip can increase the download time of the page by up to 4-5
The foreach syntax structure is used to iterate through an array.
foreach ()
The PHP foreach () syntax structure is used to traverse an operation or an output array, and foreach () can only be used to iterate over an array or an object, resulting
Closure, an anonymous function, is php5.3 when introduced, also known as anonymous functions. The literal meaning is that there is no function to define the name. For example, the following code (filename is do.php)
The A () here is never used as
The flush () function sends all the output of the program so far to the user's browser.
0; $i-) {echo $i; flush (); sleep (1);}?>
According to the PHP manual,This function sends all the output of the program so far to the user's browser.The above
Type declaration
Look at the code, at a glance.
Class Person{public function age (Int. $age): string { return ' is '. $age; }}
namespace and Use Keyword batch Declaration
Non-mixed mode
Use publishers\packt\{book, Ebook, Video};use
It is very simple to delete an array element in PHP, but sometimes deleting an array requires some ordering of the index and we will use the relevant function, here we introduce the use of Unset,array_splice to delete the elements in the array of
Loop control Statements
Conditional control statements, which can execute different statements depending on the condition selection. But sometimes you need to reuse a piece of code or function.
While Loop statement
The while loop is the simplest
PHP 4 introduces a foreach structure, much like Perl and other languages. It's just aIterating through an array
simple method. foreach can only be used in arrays when attempting to use it for otherData type
or an uninitialized variable generates an
In PHP with the header ("location:test.php") to jump to pay attention to the following points, to help solve some of the problems novice often encountered
1, location and ":" No space between, otherwise it will be wrong.
2, before using the header
1. PHP comparison Operators
$a = = $b equals TRUE If the $a equals $b.$a = = = $b congruent TRUE if $a equals $b, and they are of the same type. (introduced in PHP 4)$a! = $b unequal to TRUE if $a is not equal to $b.$a <> $b Not equal to TRUE if $a
1. Use function start; 2. The function name can start with a letter or an underscore;3. The function body must be within curly braces ;
1
4.php function can have no parameters, can also have more than one parameter, if there are
Vagrant is a software for simple virtual machine operations, and there are several benefits of using virtual machines:
1, in order to develop the environment and production environment consistent (many development environment for Windows and
In PHP, we can use 3 ways to convert a string to an integer.
1. Coercion type conversion Mode
Coercion type conversion is the way to "precede the variable to be converted with a target type enclosed in parentheses".
For an integer type, the cast
The comparison operators in PHP are a bit weird and prone to errors, and now the comparison rules are listed:
1, when the size comparison of two characters, is compared to the ASCII size of the two characters-this article is easy to understand.
2,
The loop structure in PHP has roughly a for loop, while loop, do{} while loop, and several foreach loops, regardless of the loop, there are several ways to jump out of a loop in PHP:
Code:
'; } $i + +;} Exit;echo ' here does not output ';? >
1. Arithmetic operators:
%: modulo operation (take remainder operation)/: Division operation (Result is quotient value)Note: The above two operation divisor cannot be 0, and in the PHP language, the operands of both sides are converted to integers
For loop
just a little bit more code while looping it to it. And the common task of a cycle involved is:
1. Set the initial value of some counter variables.2. Please check that the condition statement is correct.3. The code loop in execution.4.
PHP Introductory tutorial operator and control structure process, combined with the example of a detailed analysis of PHP basic assignment, self-increment, comparison, trinocular operator and IF statements, switch statements, for statements and
PHP in the ternary operator is also called the three-mesh operator, in fact, I often call it a question mark as a running character can actually do this, ternary operators can achieve a simple conditional judgment function, I would like to give you
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