SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    557
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to get a specific chunk of array from an array into an array ?

    Hi,

    I have a big array from which I need a specific chunk extracted into a new empty array ?
    How do i achieve that ?

    Eg.

    Code:
    fruits
      -- apples
      -- mangoes
          -- big mango
          -- small mango
          -- green mango
      -- grapes
      -- banana
    how to get mangoes out of fruits array into a new empty array so I am left with mangoes only ?

    Thanks.

  2. #2
    SitePoint Mentor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,270
    Mentioned
    33 Post(s)
    Tagged
    5 Thread(s)
    Hi Tapan,

    The simplest way would be to do this:
    PHP Code:
    $mangoes $fruits['mangoes']; 

  3. #3
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    557
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by fretburner View Post
    Hi Tapan,

    The simplest way would be to do this:
    PHP Code:
    $mangoes $fruits['mangoes']; 
    Hi,

    Did'nt reliase it was so easy to that. Works great.

    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •