PHP array functions (3), php array FunctionsArray retrieval functions
Format: array array_keys (array arr [, mixed searchValue]); return the "key name" in the arr array in the form of an array. If the optional parameter searchValue is
Definition of an arrayThe essence of an array is to manage and manipulate a set of variables, which can store arbitrary lengths of data, and can store any type of data. The cells in the array are called elements, each element includes subscripts
Sort: This function assigns a new key name to the cells in the array. This will delete the original key name and not just reorder it.Rsort: This function reverses the order of the array (highest to lowest). Delete the original key name and not just
arrays, which can be said to be a more important way of data application in PHP. PHP array functions are numerous, below is a few summary, take this to remember, easy to later.1. Array DefinitionsThe definition of an array is defined using the array
With the rapid development of PHP, with its people more and more, in the PHP array learning excerpt section to learn the most basic PHP array of the establishment and the number of elements of the display. Need to learn more about the operation of
1 Find character position function:
Strpos ($str, Search,[int]): Find the first position of search in $str starting from int;
Stripos ($str, search,[int]): function returns the position where the string first appears in another string. This function
Tip tips:
Array_keys ($array)//Return all key names
array_values ($array)//Return all key values
$result =array_reverse ($input);//invert array without retaining key name
$result _keyed=array_reverse ($input, true);//reverse array,
1, quickly create an array of functions range ()For example, the range () function can quickly create an array of numbers from 1 to 9:
Copy Code code as follows:
$numbers =range (1,9);
echo $numbers [1];
?>
Of course, using
In programming to look up the manual is indispensable, so you will learn to use the existing things, as in PHP, the array processing function already has a sort function, why write something is a hard to write bubble or heap row or fast row.
Often, developers find it useful to use this data structure in PHP to sort values or array elements. PHP provides a number of sorting functions that are suitable for multiple arrays, which allow you to arrange elements within an array, and also
In PHP, the values stored in the array become array elements, the array has a one-dimensional array and a multidimensional array, and the index of each array element is also called the keyword, and access to the array elements can be indexed.
This article mainly introduces the php one-dimensional two-dimensional array key sorting method, summarizes the bubble sorting method for one-dimensional arrays in the form of examples, and uses array_multisort () to sort two-dimensional arrays by
An array is a group of elements with some common characteristics, including similarity and type. Each element is distinguished by a special identifier, called a key, and each key has a value 1. what is an array?
An array is a group of elements with
This article provides a detailed analysis of the collection of PHP array sorting functions and their relationships. For more information, see
The sorting of several array functions mentioned below has some commonalities:1. the array is used as a
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
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
This article describes how php performs
Php one-dimensional two-dimensional array key sorting method example summary, two-dimensional array example
This example summarizes the one-dimensional two-dimensional array key sorting method of php. Share it with you for your reference. The
With the rapid development of PHP, more and more people are using it. In the PHP array learning excerpt, I learned about the establishment of the most basic PHP array and the display of array elements. You need to learn more about PHP Array
PHP has been developing for a long time and many users are familiar with PHP. Here I will share my understanding of PHP array sorting and discuss it with you. PHP is a server-side scripting language that is easy to learn and use. With little
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.