1.array_shift() moves the first unit of the array out and then returns it. This is very convenient for sometimes the first unit of the array needs to be processed separately.
Copy the code The code is as follows:
$tmparray = array("1", "2", "3", "4");
$tmparray = array_shift ($tmparray);
print_r($tmparray);
?>
Copy the code The code is as follows:
$tmparray = array('a', 'b', 'c', 'd', 'e');
print_r(array_chunk($ tmparray, 2));
?>
Copy code The code is as follows:
$tmparray = array ("a", "b");
array_push ($tmparray, "c", "d");
print_r( $tmparray);//Array([0] => a[1] =>b[2] =>c[3] =>d)
?>
Copy the code The code is as follows:
$tmparray= array ("a", "b");
$resarray = array_unshift ($tmparray , "c", "d");
print_r($resarray )//Array([0] => a[1] =>b[2] =>c[3] =>d)
?>
Copy the code The code is as follows:
$tmparray = ("a" => "a ","b" => "b","c" => "c","d" => "b");
$resarray = array_unique($tmparray);//("a" = > "a","b" => "b","c" => "c");
?>
The above has introduced the practical case analysis of international trade and the analysis of common array processing methods in PHP, including the content of practical case analysis of international trade. I hope it will be helpful to friends who are interested in PHP tutorials.