Php removes blank elements from an array (including elements with only blank characters) and converts a two-dimensional array to hashmap /**
* Remove blank elements from the array (including elements with only white spaces)
*
* @ Param array $ arr
*
Shuffle with Array_rand definition and usage, you need a friend to refer to below.
Shuffle () Definition and usageThe shuffle () function rearranges the elements in the array in random order.Returns TRUE if successful, otherwise FALSE is
Createtypechar_tableistableofvarchar2 (4000); -- create a custom type script createorreplacefunctionsplit_string (pi_strin
Create type char_table is table of varchar2 (4000); -- create a custom type script create or replace function split_string (pi_
When creating a project, you must return the values in an array.
Then obtain each value from the array.
Write a function that returns an array:
# region obtain the dynamically created Control name private string [] controlname () { string
1.
$arr = Array ();
$arr [] = ";
2.
$arr = Array ();
Array_push ($arr, ");
Just do a 100,000-time loop insert, the result is the first one to be faster! (circular insertion number, 100,000 times, the first 0.04 or so, the second type of 0.08
/**
* Remove blank elements from the array (including elements with only whitespace characters)
*
* @param array $arr
* @param boolean $trim
*/
Copy CodeThe code is as follows:
Function Array_remove_empty (& $arr, $trim = True)
{
foreach ($arr as
Arrayarray_slice (array $ array, int $ offset [, int $ lengthNULL [, bool $ preserve_keysfalse]) function: extracts a subarray sequence from an array. Description: array_slice () is returned based on offset and leng.
array array_slice ( array $array
1. the array_searchmixedarray_search (mixed $ needle, array $ haystack [, bool $ strictfalse]) function searches for a given value in the array. if it succeeds, the corresponding key name is returned in & nbsp; haystack & nbsp; In Search 1.
1. array_walkboolarray_walk (array & amp; $ array, callable $ funcname [, mixed $ userdataNULL]) 1. function to apply user functions to each member in the array. description: user-defined functions & nbsp; funcname & n 1, array_walk
bool array_walk (
This article gives you a simple comparison of the usage of the PHP array current and Next, although the example is simple, but it is very helpful for us to understand current and next, which is recommended here.
1.current
2.next
The example
Several common PHP functions for removing null, grouping, and debugging arrays. read several common PHP functions for removing null, grouping, and debugging arrays. dump () converts arrays to arrays in array format, useful for debugging functiondump
Function callback is a special mechanism in PHP. This mechanism allows you to input a user-defined function address in the function parameter list as a parameter to process or complete certain operations. You can use the callback function to easily
There is a dedicated data structure solution in a strong-type language. Generally, a container is created to store any type of data in the container, and the container capacity can be determined based on the data stored in the container to achieve a
When an array is returned as a function value, memory leakage is very likely to occur.
Symptom: Illegal memory access is prompted after the application is built, but the compile application does not.
Question: the return value of a function is
Concat
Connect the parameter list to the back of the original array to form a new array and return it. The original array is not affected.
var arr = ["a","b","c"];var arr1 = arr.concat("d","e");//arr1 = ["a","b","c","d","e"]Join
Use the specified
1.request_uri gets to the last element Index\test1\test2\test3 (the routing path for the generic framework is this)
$request _uri = "Index\\test1\\test2\\test3"; $arr =explode ("\ \", $request _uri); $moudle = Array_shift ($arr); $control = Array_
Array_values () Definition and usage
The Array_keys () function returns a new array containing all the key names in the array.
If the second argument is provided, only the key name with the value is returned.
If the strict parameter is specified
To create an indexed array
$arr =array (' name ' => ' Molaifeng ', ' age ' => ', ' height ' => ' 167 ');
foreach ($arr as $value) {
echo $value. ' ';
}
echo ' ';
when referencing an array cell indexed by a character, the index must be enclosed in
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.