In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
PHP array function summary and sharing, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
I have read a lot of knowledge about PHP array functions on the Internet these days. I feel that Master Kong's "reviewing the old and knowing the new" is true. Here are some experiences I have summed up. I hope it will be helpful to you.
Analysis of the principle of PHP uploading multiple Files by APC method
Beginners must see the full disclosure of the progress of uploading files on PHP.
PHP upload file code of master's notes
The basic concept of PHP array of treasure box is introduced in detail.
Mining PHP array function library array array creation and use
The array in PHP is actually an ordered graph, which is a type that maps values to keys. This type is optimized in many ways, so you can use it as a real array, or lists (vectors), hash tables (an implementation of graphs), dictionaries, collections, stacks, queues, and more. Because you can use another PHP array as a value, you can easily simulate a tree. Explaining these structures is beyond the scope of this manual, but you will find at least one example of each structure. For more information on these structures, we recommend that you refer to external works on this broad topic. Here are some of my experiences with PHP array functions:
1. Split a 1-dimensional array into a 2-dimensional array array_chunk ()
Input_array=array (print_r (array_chunk ($input_array,2))
two。 Compare two arrays, array_diff_assoc () or array_diff (). If the return value is empty, it means that the two arrays are the same, otherwise they will be different.
3. Use a function to filter the numeric value array_filter () in the array
Functionodd ($var) {return ($var%2==1);} functioneven ($var) {return ($var%2==0);} $arrayarray1=array ("a" = > 1, "b" = > 2, "c" = > 3, "d" = > 4, "e" = > 5); $arrayarray2=array (6 Odd:\ n); print_r (array_filter ($array1, "odd")); echo "Even:\ n"; print_r (array_filter ($array2, "even");? >
4.array_map () applies the callback function to the cells of a given array. Its arguments can be one array or multiple arrays, and the parameters of the callback function must be the same as the parameters that call it.
/ / an example of a single parameter, multiplying each value in the array by its cubic functioncube ($n) {return$n*$n*$n;} $a=array; $b=array_map ("cube", $a); print_r ($b);? > / / an example of multiple array parameters functionshow_Spanish ($n ~ m) {return "Thenumber$niscalled$minSpanish";} functionmap_Spanish ($n = > $m) {returnarray ($n = > $m);} $a=array $b=array ("uno", "dos", "tres", "cuatro", "cinco"); $c=array_map ("show_Spanish", $aGramb); print_r ($c); $d=array_map ("map_Spanish", $aLindjobb); print_r ($d);? > / output results / / printoutof$c Array ([0] = > Thenumber1iscalledunoinSpanish [1] = > Thenumber2iscalleddosinSpanish [2] = > Thenumber3iscalledtresinSpanish [3] = > Thenumber4iscalledcuatroinSpanish [4] = > Thenumber5iscalledcincoinSpanish) will it help you to read the above? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.