Home > Backend Development > PHP Tutorial > Detailed explanation of php5 and mysql5 web development technology 1 -php array_PHP tutorial

Detailed explanation of php5 and mysql5 web development technology 1 -php array_PHP tutorial

WBOY
Release: 2016-07-14 10:09:00
Original
1379 people have browsed it

1. Create or extract immediately

Range() quickly creates an array with specified element values.
Example:
range(0,6)
range(0,10,2)
range('a','z')
shuffle() shuffle the order of the array
array_rand() specifies the number of elements and then extracts them. If you extract an element, a variable is returned; if you extract multiple elements, you return an index array
2. Array sorting
sort() Sort according to ASCII code order Sort priority: numbers, letters, Chinese characters
asort() sorts by array associativity
ksort() Sort in ascending order by array index value
krsort () Sort in descending order by array index value
3. Statistical function
array_count_values ​​counts the number of occurrences of array elements
array_sum(array $a) Sum of array elements
count()
sizeof()
4. Array processing
array_combine(array a1,array a2) Array merging a1 as the key name, a2 as the key value
array_unique(array $a)
array_flip() key value swap
5. Search
array_key_exists($key_str, $array)
in_array($value_str, $array,[bool])
6. Move the internal pointer of the array
current()
next()
prev()
end()
7. Obtain the associative array key name
key()
8. Access the key name and key value of the array
array_keys()
array_values()
9. Determine array type (to be added)
is_array()
10. Display content and structure
print_r()
var_dump()
var_export()
11. Element insertion and removal
unset()
array_shift()
array_unshift() insert at the top
array_splice()
array_push()
array_pop()
12. Export content as variables
extract()
13. Others
list ()
each()
for()
foreach()

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477736.htmlTechArticle1. Create or extract range() quickly to quickly create an array with specified element values. Example: range(0,6) range(0,10,2) range(a,z) shuffle() shuffle the array order array_rand() specify...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template