Php: how to use the array_merge () function to merge correlated and non-correlated arrays _ PHP Tutorial

Source: Internet
Author: User
Php uses the array_merge () function to merge correlated and non-correlated arrays. Php uses the array_merge () function to merge correlated and non-correlated arrays. This article mainly introduces the php method to merge correlated and non-correlated arrays through the array_merge () function, methods for merging correlated and non-correlated arrays using the array_merge () function of array php in php

This article mainly introduces how to use the array_merge () function to merge correlated and non-correlated arrays in php. it involves the array merging technique of the array_merge () function in php. For more information, see

This example describes how to use the array_merge () function to merge correlated and non-correlated arrays in php. Share it with you for your reference. The specific analysis is as follows:

Array_merge () is a php function used to merge arrays. The last array is appended to the ending position of the previous one and the merged result array is returned.

?

1

2

3

4

5

6

$ Beginning = 'foo ';

$ End = array (1 => 'bar ');

$ Result = array_merge (array) $ beginning, (array) $ end );

Print_r ($ result );

?>

The output result is as follows:

?

1

2

3

4

5

Array

(

[0] => foo

[1] => bar

)

I hope this article will help you with php programming.

Merge () function merging association and non-correlated array method this article mainly introduces php's method of merging correlated and non-correlated arrays through the array_merge () function, involving array in php...

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.