PHP Knowledge point cluster (continuous update) (2)

Source: Internet
Author: User
Tags bulk insert
PHP Knowledge Point Aggregation (continuous update) (2)

1, explode
explode-using one string to split another string
Array explode (string $delimiter, string $string [, int $limit])
This function returns an array of strings, each of which is a substring of string, separated by the delimiter of the strings as the boundary points.
http://php.net/manual/zh/function.explode.php

?

2. PHP time () function
Definition and usage
The time () function returns the Unix timestamp for the current time.
Returns the number of seconds since the Unix era (January 1, 1970 00:00:00 GMT) to the current time.
Http://www.w3school.com.cn/php/func_date_time.asp

http://php.net/manual/en/function.time.php

?

3, unset
Unset-releasing the given variable
void unset (mixed $var [, mixed $ ...]
Unset () destroys the specified variable.
The behavior of unset () in a function depends on the type of variable you want to destroy.
If you unset () a global variable in a function, only the local variable is destroyed, and the variable in the calling environment keeps the same value as before the call to Unset ().

http://php.net/manual/zh/function.unset.php

?

4, PHP to the array assignment (two-dimensional array assignment) detailed
In the PHP array assignment is very simple, if it is a one-dimensional array assignment than a two-dimensional array or multidimensional array is simpler, below I will give you to the array assignment of various examples introduced, there is a need to understand the friend can refer to.
What about the PHP array assignment? As follows:
Example 1, a one-dimensional array assignment, the instance code is as follows:
$My _array=array ();??
$My _array[]= "www"???
$My _array[]= "helpphp";???
$My _array[]= "cn";
Destroy the array with the following code:
Unset ($My _array[0];
unset ($My _array);

Http://www.phpfensi.com/php/20140223/1660.html

?

5. mysql Bulk Insert Data method
Insert inserts multiple data There are two ways to write multiple INSERT statements with ";" Each SQL, one is multiple value of insert itself
1, write multiple insert with ";" Segmentation
This is very simple, the number is MySQL executes the SQL Terminator, writes the multiple inserts to use, the number cuts is lets the MySQL executes several times. For example:
Insert into table (FIELD1,FIELD2,FIELD3) value (' A ', "B", "C");
Insert into table (FIELD1,FIELD2,FIELD3) value (' A ', "B", "C");
Insert into table (FIELD1,FIELD2,FIELD3) value (' A ', "B", "C");
Insert into table (FIELD1,FIELD2,FIELD3) value (' A ', "B", "C");
Insert into table (FIELD1,FIELD2,FIELD3) value (' A ', "B", "C");
2, write multiple value in insert
INSERT into table (field1,field2,field3) VALUES (' A ', "B", "C"), (' A ', "B", "C"), (' A ', "B", "C");

Http://www.phperz.com/database/MySQL/0PS60120113601.html

?

6. Passing parameters by reference
By default, a function parameter is passed by value (so that it does not change the value outside the function even if the value of the parameter is changed inside the function). If you want to allow a function to modify its parameter values, you must pass the arguments by reference.
If you want a parameter of a function to always be passed by reference, you can precede the argument with a symbolic & in the function definition:
Example #2 passing function arguments by reference

 
  

? http://php.net/manual/zh/functions.arguments.php

?

7. Split
Split-using regular expressions to split a string into an array
This function returns an array of strings, each of which is a string with a case-sensitive regular expression pattern as a substring of the boundary. If limit is set, the returned array contains a maximum of limit cells, and the last cell contains all the remaining parts of the string. If there is an error, split () returns FALSE.
Split the first four fields in the/etc/passwd:

Example #1 Split () example

?

 
  

? http://php.net/manual/zh/function.split.php?

?

?

  • 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.