Php array small Functions

Source: Internet
Author: User

Recently, the project needs to have such a requirement on the array. The content of the array may change constantly. If you know a key name of the array, how can you get the next key name? At the beginning, I thought it would not be easy to write. I kept searching for Array-related functions in the book and searching the Internet. I found none of them. So I did not expect it to be easy to write. [Html]/** find the next key name of the current key name of the array * $ keys current key name * return the next key name */function next_array ($ array, $ keys) {$ n = 0; foreach ($ array as $ key => $ value) {if ($ n = 1) return $ key; if ($ key = $ keys) $ n ++} found that many times, you still have to rely on yourself.

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.