PHP array operation function summary. The most common data structure in PHP is an array. arrays can help us solve a large part of programming problems. In fact, many array operations do not need to be written by ourselves. the system already comes
Count the number of elements in a two-dimensional array. Record the solution to the next problem, which involves the usage of several functions. Describe the problem first. The field content in the data table stores a comma-separated word record for
Array pointer operation: Moves the array pointer operation: Next () down Gets the value of the current element. Prev () will also get the value of the current element. End () moves to the last element cell to get the value of the last element reset (
about sort generally we are all sorted by database or NoSQL (Eg:redis) and then output to the program directly, but sometimes we need to sort the arrays directly via PHP, and the most used data in PHP is object and array. But the more processing is
Array:See the illustrations in detail!One, array typeSee Diagram!Second, array creationMethod One,Variable name [index value]= data;Variable name []= data;//non-write index value default is indexed array, starting from 0Method Two,Variable name
Searches for a specific value in the array and returns TRUE if found returns false
Boolean In_array (mixed Needle,array Haystack[,boolean Strict])
Finds a specified health in the array, returns true if found or false
Boolean array_eky_exists (mixed
Highlight:
1, the use of PHP can also achieve the page div cutting processing. The practice here is to offer the reader a more perfect solution.
2, cutting processing method has been encapsulated into a method, can be directly referenced.
3, by the
A What is an array
An array is a set of elements that have some common characteristics, including similarity and type.
Each element is distinguished by a special identifier, called key, and each key has a value
1. Two ways to create an array:
1.1
With a lot of array sorting functions in PHP, let's hit about the use of PHP array sorting.
The array is used as the parameter of the sort function, and after sorting, the array itself is changed, and the return value of the function is type bool.
2
As you know, the most common function of array sorting is sort ($ arr). it is used to sort by the key values of the array in ascending order, in addition, the sorted array key name is no longer the original key name, and is duplicated by the new
I wrote some basic PHP syntax, as well as form submission and processing. in this article, I wrote the usage of arrays and the processing of arrays and strings, I hope to help you: I wrote some basic PHP syntaxes and submitted and processed forms in
Generally, all elements in an array are represented by characters or numbers. Therefore, you can sort the array elements in ascending order. This function is sort (), for example: & lt ;? Php $ learn learray (& amp; 39; name & amp; 39;, & amp;
PHP learning array. An array is a collection of data. it organizes a series of data to form an operable whole. Each object in the array contains two items: Key and value. 1. what is an array is a set of data, which organizes a series of data to form
The PHP array has one-dimensional arrays and no arrays, and here we analyze the techniques of PHP's two-dimensional array ordering. PHP, a nested abbreviated name, is an abbreviation for the English Super Text preprocessing language (Php:hypertext
Function name use format input/output operation
Array Generation and Transformation:
The array () generates an array of arrays (mixed [...]) for arrays of values or, key = = value An array-type variable without
Array_combine () generates an array
About discuz7.2 Association label PHPcodeif (is_array ($ data ['relatedtag'] ['order']) {asort ($ data ['relatedtag'] ['order']); $ re about discuz7.2 associated tags
PHP code
if(is_array($data['relatedtag']['order'])) {
I want to sort the arrays numerically, with the following code:
$a = array('a' => 10, 'z' => 10, 'c' => 10, 'b' => 11, 'd' => 10);asort($a, SORT_NUMERIC);var_dump($a);
The printing results are as follows:
array(5) { 'd' => int(10) 'a' => int(10)
This article describes how php performs operations on two-dimensional arrays, including sorting, transforming, removing spaces, and deduplication of two-dimensional arrays by php. For more information, see
Tip:
Array_keys ($ array) // returns all
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.