Learning notes for PHP and MySQLWeb development: 1 ~ Chapter 3

Source: Internet
Author: User
I borrowed this book from the library two days ago and I have heard about this "Bible" before. I have chosen several chapters and read them. I feel that the content is quite meticulous and it will be helpful for consolidating the PHP Foundation. So, order to buy one. Today, I read about the first three chapters: "PHP Quick Start", "data storage and retrieval", and "using arrays ". All are the most basic

I borrowed this book from the library two days ago and I have heard about this "Bible" before. I have chosen several chapters and read them. I feel that the content is quite meticulous and it will be helpful for consolidating the PHP Foundation. So, order to buy one. Today, I read about the first three chapters: "PHP Quick Start", "data storage and retrieval", and "using arrays ". All are the most basic

I borrowed this book from the library two days ago and I have heard about this "Bible" before. I have chosen several chapters and read them. I feel that the content is quite meticulous and it will be helpful for consolidating the PHP Foundation. So, order to buy one.

Today, I read about the first three chapters: "PHP Quick Start", "data storage and retrieval", and "using arrays ". These are the most basic things. They are more meticulous than they are. They can be used as manuals. After all, it is not practical to use so many function methods.


1. Chapter 1There is nothing special to mention. Other forms of tag, comment, and form variables are known, but they are not used ...... For the "delimiters", the book is just a rough one. Google, I think it is quite useful:

 Data ~~~ EOF
The end mark is followed by three left angle brackets. It is defined by itself and is separated from the data by a single row. Data in the delimiters will be directly output, regardless of the length, special characters do not need to be escaped. To output a variable, use braces.

Another point worth emphasizing is the similarities and differences between print and echo. What about the interview gold ~

Similarities: · none of them are real functions; · all can be called in the form of functions with parameters; · all can be used as operators;

Different points out: · calls print in the form of a function, and returns the value (1); · print is slower than echo;


2. Chapter 2This section describes how to store and retrieve data using files and how to use various file operation functions. I personally feel that it is of no particular use now ............


3. Chapter 3And is practical. One of the major advantages of PHP is its powerful array operations!

3.1 range () function,

array range ( mixed $start , mixed $end [, number $step = 1 ] )
This creates and returns an array containing elements in the specified range. From $ start to $ end, the Order is in the ASCII code table. $ Step is the span. Example:
 String 'A' (length = 1) 1 => string 'D' (length = 1) 2 => string 'G' (length = 1) 3 => string 'J' (length = 1) 4 => string 'M' (length = 1) 5 => string 'P' (length = 1) 6 => string 'S' (length = 1) 7 => string 'V' (length = 1) 8 => string 'y' (length = 1) 9 => string '\' (length = 1) 10 => string '_' (length = 1) 11 => string 'B' (length = 1) 12 => string 'E' (length = 1) 13 => string 'H' (length = 1) 14 => string 'K' (length = 1) 15 => string 'n' (length = 1) 16 => string 'q' (length = 1) 17 => string 'T' (length = 1) 18 => string 'w' (length = 1) 19 => string 'Z' (length = 1 )*/

3.2 loop traversal of Arrays: foreach (), each (), list ()

Familiar with the use of foreach () syntax structure

  $val ){    ...}

Each array has an internal pointer pointing to the current element in the array. When each () is used, the pointer is indirectly used. It returns an array containing four elements, which is the content of the element pointed to by the current pointer.

 'Apple'); var_dump (each ($ arr); // output/* array 1 => string 'apple' (length = 6) 'value' => string 'apple' (length = 6) 0 => string 'apple' (length = 5) 'key' => string 'apple' (length = 5) */
The each () function first returns the current element, and then moves the pointer one bit to the right. The next () function first moves one to the right and then returns the element. In addition, there is the prev () function, which is opposite to next (); current (), that is, pos () returns the element pointed to by the pointer currently; reset () re-point the pointer to the first element and return the element (reset () must be used to use each multiple times; end () points to the last element.

List () assigns values in the array to some variables. It is not a real function, but a language structure. Example of directly moving php.net

 

Note: The array assigned to the list must be a digital index, and the list will only find a digital index.


3.3 other sorting functions are very practical ~

Sort (), asotr (), ksort ();

Rsort (), arsort (), krsort ();

Usort ()......

Random sort shuffle ()


========================================== Split line, just like this ~ ====================================

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.