PHP number combination and split example

Source: Internet
Author: User
    1. $array 1 = Array ("A", "B", "C", "D");
    2. $array 2 = Array ("1", "2", "3", "4");
    3. $array 3 = Array ("!", "@", "#", "$");
    4. $arrayX = Array_merge ($array 1, $array 2, $array 3); Merge 3 arrays together
    5. Print_r ($arrayX);
    6. ?>
Copy Code

Example 2,php array Merge.

    1. $array 1 = Array ("AA" = "A", "BB" = "B", "CC" = "C", "DD" = "D");
    2. $array 2 = Array ("AA" = "1", "BB" = "2", "CC" = "3", "DD" = "4");
    3. $array 3 = Array ("AA" = "!", "BB" = "@", "CC" = "#", "DD" = "$");
    4. $arrayX = Array_merge ($array 1, $array 2, $array 3); Merging arrays
    5. Print_r ($arrayX);
    6. ?>
Copy Code

Example 3,php array Merge.

    1. by bbs.it-home.org
    2. $array 1 = Array ("AA" = "A", "BB" = "B", "CC" = "C", "DD" = "D");
    3. $array 2 = Array ("AA" = "1", "BB" = "2", "CC" = "3", "DD" = "4");
    4. $array 3 = Array ("AA" = "!", "BB" = "@", "CC" = "#", "DD" = "$");
    5. $arrayX = array_merge_recursive ($array 1, $array 2, $array 3);//merge array
    6. Print_r ($arrayX);
    7. ?>
Copy Code

Example of 4,php array split.

    1. $array = Array (1,2,3,4,5,6,7,8,9);
    2. $arrayX = Array_splice ($array, 2, 6); Gets the 2nd element of the array to the 7th element
    3. Print_r ($array);
    4. Print_r ($arrayX);
    5. ?>
Copy Code

>>> you may be interested in the article: PHP array splitting with array splicing PHP chunk function split array instance PHP MB_CHUNK_ Split function supports wide character split PHP space split text Array example PHP split Chinese string array simple example PHP split in English string several ways PHP split () Application of string splitting function example PHP segmentation GBK Chinese garbled solution PHP string segmentation function Explode example PHP array merge sample code PHP merge two arrays of PHP based on the method of classification merging arrays PHP array operation instance of PHP array merge, Append to Join Method (Array_merge (), Array_combine () function) about PHP number combination and merge with recursive example PHP array Merge instance Learning

  • 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.