SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast stationmaster's Avatar
    Join Date
    May 2003
    Location
    barcelona
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Filtering a multidimansional array?

    I need to pull certain keys and there values from a multiarray.
    And create a new comma seperated variable with those values.
    The Key which I'm after is the ["ID"] of each entry.

    start array;
    PHP Code:
    array(5) { 
    [
    0]=>  object(stdClass)#42 (2) { ["title"]=>  string(2) "t1" ["ID"]=>  string(3) "522" } 
    [1]=>  object(stdClass)#44 (2) { ["title"]=>  string(2) "t2" ["ID"]=>  string(3) "415" } 
    [2]=>  object(stdClass)#41 (2) { ["title"]=>  string(2) "t3" ["ID"]=>  string(3) "835" } 
    [3]=>  object(stdClass)#43 (2) { ["title"]=>  string(2) "t4" ["ID"]=>  string(3) "518" } 
    [4]=>  object(stdClass)#45 (2) { ["title"]=>  string(2) "t5" ["ID"]=>  string(2) "30" } } 
    desired final variable:
    PHP Code:
    string(17"20, 796, 842, 838" 
    Thanx for any pointers.
    Daiv Mowbray twincascos Barcelona
    wordpress pluginswp-superslider.com
    portfolio portfolio.daivmowbray.com
    personal blogwww.daivmowbray.com

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,048
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    PHP Code:
    $id = array();
    foreach(
    $entries as $entry$id[] = $entry['ID']; 


Tags for this Thread

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
  •