PHP arrays, functions.

Source: Internet
Author: User

PHP the line break symbol inside is in ;

Array_combine : Stitching an array. The value of the previous array as the subscript for the new array, and the value of the next array as the value of the new array.

array_count_values : The number of occurrences of each value in the statistics array.

Array_diff : Output difference Array ($b, $a);

Array_flip : Output The value first, then output subscript. If there are two identical subscripts, then the back will overwrite the previous one.

array intersect ($a, $b) : The intersection between the output arrays and retained; (Note that it retains the subscript for the value in $ A.) )

array_key_exists: checks whether an array's subscript exists (the return value is a bool value).

Array_keys (array [specify values, whether or not to compare specified values]): Returns all the subscripts of an array that appear as values for the new array. A total of three parameters, the latter two do not have to write, (this thing try not to use).

Array_merge: merges one or more arrays. (at least one array, but if there is only one array, it has no other array at all to merge, and if it is multiple arrays, it will concatenate the arrays sequentially.) Even if there is a custom subscript in the array, the new array does not abandon it, but instead displays a custom subscript. )

& is the address character that takes the memory.

So the &$ can only be placed after the variable, can not put value.

Pop is to remove the value at the end of the array, andpush is to add one or more values to the end of the array, returning the number of elements of the new array (that is, the original array that has been changed).

Array_rand : Random extraction of one or more elements from an array (roll dice), and returns the subscript of this value;

Array_replace : Merges the array and generates a new array, the new array will be based on the previous array, and the same value is girls between several arrays.

Array_reverse : Returns an array that is opposite to the original array cell. (for associative types, flip an array, and do not retain the subscript for the numeric type; for an indexed array, only the array is reversed, and the subscript remains the default.) )

Array_shift : Removes the first element of the array and returns the element. If the subscript type is a numeric type, it is re-indexed in the form:array_alice(array, start position, [number of intercepts, whether to keep subscript], and if the third number is negative, the position is represented. )

Array_unshift : Inserts one or more cells at the beginning of the array.

Array_splice : Removes part of an array and replaces it in the form array_splice(array, start position, [number of intercept, value for substitution], or position if the third number is negative. As long as it is an array, it will follow the same rules.

array_values : Transforms the associative array into an indexed array.

Array_unique : Removes duplicate values from an array, obtains a new one, does not change the original array, and retains the first value if the duplicate value is not the same as the subscript.

In_array : Determines whether a value exists in the array. (Returns a Boolean value of True if the value exists, as opposed to checking for the presence of a subscript in the array)

In PHP, you can think of a string as a number as a real number.

Range : Generates an array (such as 1~100,a~z) that holds your specified range of cells.

Format:range(start, End ,[ step]).


This article is from the "12244243" blog, please be sure to keep this source http://12254243.blog.51cto.com/12244243/1883186

PHP arrays, functions.

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.