Php array acquisition

Source: Internet
Author: User
Onetwothree is an array. If you put the following numbers in the array, place the last 10 numbers to 1.


One two three is an array. If you put the following numbers in the array, put the last 10 numbers into 1.

Reply content:


One two three is an array. If you put the following numbers in the array, put the last 10 numbers into 1.

What do you want to express?

That's a two-dimensional array.

You mean to change $ array_1

$array_1 = array{    'one' => array('1','2','3','10'),    'two' => array('4','5','6'),    'three' => array('7','8','9')};

?

$j = 0;$array_3 = $array_1;for($i=0;$i
  

$array_1 = ["one", "two", "three"];$array_2 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];$tmp = array();for($i = 0, $j = 0; $i < count($array_2); $i++) {    if($i % 3 == 0 && $i != 0) $j++;    if(count($array_1) == $j) $j = 0;    $tmp[$array_1[$j]][] = $array_2[$i];}

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.