1.for usage
Case
{$i}
resolves to
for ($i =1; $i
2.switch usage
Output 1 Output content 2 Default
Case
value1 value2 default
You can also use variables for the Value property of the case, for example:
admin member
File_get_contents
The () function reads the entire file into a string, and, like file (), file_get_contents () reads the file into a string.
The file_get_contents () function is the preferred method for reading the contents of a file into a string,
for a newly-started PHP programmer, the PHP buffer is almost transparent. In their minds, a
echo print_r function
, the data will be "swish" to fly to the browser, displayed. I have always been so simple to think. In fact, in the world of technology,
PHP only in the HTTP protocol to the HTML document header sent to the browser, tell the browser how to do this page, as for the content of the transfer will need to familiarize yourself with the HTTP protocol, not related to PHP,
Refer to the
Requirements are: the ability to mask sensitive words when a user submits a form. Sensitive words from the server side of the same path under the ciku.txt, sensitive words through the "|" connections, such as "g|c|a", replace sensitive words when
before we generateVerification Code
will need to enter the image directly, usually use to the header ("Content-type:image/jpeg"), to achieve, here is a brief introduction.
In many developments, we tried to use the header ("Content-type:image/jpeg")
First of all, buffer, it is a memory address space, for 4096 (1KB) "found in the php.ini configuration file output_buffering Configuration", PHP has a php output_buffering mechanism, PHP code in the execution of the time, Not immediately the content
we all know JS inString interception
character hasFunction
substr and substring, what about PHP, PHP does not have a directly available substring function, but there are substr functions.
Don't believe you can test it. Here's a good piece of code.
Assume that the field of the ledger account data table in the database is: Id,code,name,islast. is the self-increment primary key, the account code, the account name, whether the last level ("1" represents the last level account). Here, the data
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
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
In connection with multiple different repositories, you need to write multiple connections, to simplify the operation, you can use the base type, different repositories can use the ORM model to operate as long as the corresponding classes of classes
I. Indexed arrays
"; Echo ' contact list '; Echo ' '; Echo ' number name company address Phone EMALL '; Echo ' '; Use the double-layer for statement to nest the two-dimensional array $contact1, output//Use the outer loop
1,foreach is the cyclic output of an array of PHP.
Example:
$arr = Array ("1" = "111", "2" = "222", "3" = "333"), and foreach ($arr as $key = = $value) { echo $key. = ". $value." \ n ";}
The results are as follows:
1=>1112=>2223=>333
2, make a
foreach can easily modify the cells of an array by adding & before the $value, and be aware of the use of references in foreach. You can also disconnect the reference relationship immediately after processing, and there will be no such situation
PHP implementations of four sorting algorithms:
1) The basic idea of inserting a sort (insertion sort) is:Insert a record to be sorted each time, by its keyword size, into the appropriate location in the previously sorted sub-file until all records
Recently developed a project, need to call the third-party interface, the third-party provides the data is XML, I directly use Array2xml to convert the PHP array into XML format.
The XML format is as follows:
Since the PHP array cannot
In the common use for and foreach loops in PHP, conditions are often encountered in terms of judging or aborting loops. and the processing method mainly uses break and continue two flow control instructions, now explain the main difference
The
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