Arrays are divided into two parts:

Source: Internet
Author: User
The array is divided into two parts: one-dimensional array. Note that the key name is irregular and non-numeric: $ arrarray (wc & gt; 12, wssc & gt; 123, wac & gt; 142, w3c & gt; 124, wac & gt; 012, wsbsc & gt; 012c3, wac & gt; 014d2, w3ec & gt; 0124); it is divided into two parts: $ arr1arra array is divided into two parts
A one-dimensional array. Note that the key name is irregular and non-numeric:
$ Arr = array ('WC '=> 12, 'wssc' => 123, 'wac' => 142 ', w3c' => 124, 'wac' => 012, 'wsbsc '=> 012c3, 'wac' => 014d2', w3ec '=> 0124 );
It is divided into two parts:
$ Arr1 = array ('WC '=> 12, 'wssc' => 123, 'wac' => 142 ', w3c' => 124 );
And
$ Arr2 = array ('wac' => 012, 'wsbsc '=> 012c3, 'wac' => 014d2', w3ec '=> 0124 );

Find this algorithm

------ Solution --------------------
You didn't specify any splitting rules ――

Array_chunk ()
Or
Array_slice ()
------ Solution --------------------
The condition for splitting is obvious. you can determine whether the first character is 0.
Unfortunately, your question is wrong because the associated key wac is repeated. Therefore, the array $ arr has only 7 items.
Seven items are split into an array of eight items in total. due to insufficient conditions, there is no solution!


Aren't you challenging our IQ?
------ Solution --------------------
No matter whether your array is correct or not, this method should be feasible (an even number of elements; or an odd number, with at least one cent ):
Asort ($ arr );
Then, extract the previous one and click OK. For intercept, you can use a function or assign a value to another array.

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.