Home > Backend Development > PHP Tutorial > An example of usage of php function array_merge () (merging similar arrays)

An example of usage of php function array_merge () (merging similar arrays)

WBOY
Release: 2016-07-25 09:05:28
Original
1312 people have browsed it
  1. $arr1 = $dblink->mem_fetch_array ( "SELECT t_pid,imgname,invented,score FROM `t_sum_giftimg` where t_pid=3 or t_pid=6", 0 );
  2. $arr2 = $dblink-> mem_fetch_array ( "SELECT t_pid,imgname,invented,score FROM `t_sum_giftimg` where t_pid=10 or t_pid=12", 0 );
  3. $imgInfo = array_merge ( $arr1, $arr2 );
  4. if ($imgInfo) {
  5. foreach ( $imgInfo as $imgInfo ) {
  6. $imgs [] = $imgInfo;
  7. }
  8. }
Copy code

Articles you may be interested in: Introduction to how to create an array in php php uses array_unique to determine whether the same value exists in the array php array function in_array() finds whether the specified value exists in the array PHP array function array_key_exists() finds whether the array key exists Small example of php array deduplication Small examples of php arrays and loops Enhanced version of array_unique function (supports two-dimensional array) Application example of php array callback filter function array_filter() PHP functions and application examples for extracting variables from arrays PHP code to randomly extract some elements from an array Code to automatically add links to article content using php array How to add and delete array elements in php



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