Jump to content

Complex multi dimensional array solution


kostakondras

Recommended Posts

Hi guys,

 

I'm using the API for Remember the Milk through a PHP class that I found online called PHP-RTM. Anyway after so much headaches (the authentication for the Remember the Milk API is one of the hardest I've ever come across) I've finally connected everything and gotten to the stage that I have some raw data inside an array. The next step is to work with that data.

 

Basically I want to access the names of the task in a complex multi demensional array and I have no idea how to do this. I have done a var_dump of the array I am working with to show you the complexity. Just remember that in the complex var_dump below there are only 4 tasks:

 

array(2) { ["stat"]=> string(2) "ok" ["tasks"]=> array(2) { ["rev"]=> string(31) "nxeir6vy9pcgcggoss4wwwooc8cwo8w" ["list"]=> array(3) { [/tt]

  • => array(2) { ["id"]=> string( 8) "13927305" ["taskseries"]=> array(2) {
  • [tt]=> array(11) { ["id"]=> string(9) "104056511" ["created"]=> string(20) "2011-02-02T12:48:48Z" ["modified"]=> string(20) "2011-02-02T12:48:48Z" ["name"]=> string(42) "Send confirmation email to luxury car hire" ["source"]=> string(13) "iphone-native" ["url"]=> string(0) "" ["location_id"]=> string(0) "" ["tags"]=> array(0) { } ["participants"]=> array(0) { } ["notes"]=> array(0) { } ["task"]=> array(9) { ["id"]=> string(9) "156815180" ["due"]=> string(20) "2011-02-02T13:00:00Z" ["has_due_time"]=> string(1) "0" ["added"]=> string(20) "2011-02-02T12:48:48Z" ["completed"]=> string(0) "" ["deleted"]=> string(0) "" ["priority"]=> string(1) "N" ["postponed"]=> string(1) "0" ["estimate"]=> string(0) "" } } [1]=> array(11) { ["id"]=> string(9) "104148150" ["created"]=> string(20) "2011-02-03T01:25:57Z" ["modified"]=> string(20) "2011-02-03T01:26:17Z" ["name"]=> string(40) "Confirm that post has been sent with DVD" ["source"]=> string(2) "js" ["url"]=> string(0) "" ["location_id"]=> string(0) "" ["tags"]=> array(0) { } ["participants"]=> array(0) { } ["notes"]=> array(0) { } ["task"]=> array(9) { ["id"]=> string(9) "156951316" ["due"]=> string(20) "2011-02-02T13:00:00Z" ["has_due_time"]=> string(1) "0" ["added"]=> string(20) "2011-02-03T01:25:57Z" ["completed"]=> string(0) "" ["deleted"]=> string(0) "" ["priority"]=> string(1) "N" ["postponed"]=> string(1) "0" ["estimate"]=> string(0) "" } } } } [1]=> array(2) { ["id"]=> string( 8) "13925842" ["taskseries"]=> array(12) { ["id"]=> string( 8) "98105089" ["created"]=> string(20) "2010-12-19T11:25:25Z" ["modified"]=> string(20) "2011-02-02T13:01:42Z" ["name"]=> string(25) "Read for one hour per day" ["source"]=> string(13) "iphone-native" ["url"]=> string(0) "" ["location_id"]=> string(0) "" ["rrule"]=> array(2) { ["every"]=> string(1) "1" ["$t"]=> string(21) "INTERVAL=1;FREQ=DAILY" } ["tags"]=> array(0) { } ["participants"]=> array(0) { } ["notes"]=> array(0) { } ["task"]=> array(9) { ["id"]=> string(9) "156576423" ["due"]=> string(20) "2011-02-02T13:00:00Z" ["has_due_time"]=> string(1) "0" ["added"]=> string(20) "2011-02-01T13:01:45Z" ["completed"]=> string(0) "" ["deleted"]=> string(0) "" ["priority"]=> string(1) "N" ["postponed"]=> string(1) "0" ["estimate"]=> string(0) "" } } } [2]=> array(2) { ["id"]=> string( 8) "17007566" ["taskseries"]=> array(11) { ["id"]=> string(9) "104017503" ["created"]=> string(20) "2011-02-02T05:45:04Z" ["modified"]=> string(20) "2011-02-03T02:29:55Z" ["name"]=> string(96) "Hook up watermark for both videos (check email) and send to Rachelle and Steve at compare quotes" ["source"]=> string(2) "js" ["url"]=> string(0) "" ["location_id"]=> string(0) "" ["tags"]=> array(0) { } ["participants"]=> array(1) { ["contact"]=> array(3) { ["id"]=> string(7) "2150286" ["fullname"]=> string(10) "Samuel Nam" ["username"]=> string(10) "samuel.nam" } } ["notes"]=> array(0) { } ["task"]=> array(9) { ["id"]=> string(9) "156754354" ["due"]=> string(20) "2011-02-02T13:00:00Z" ["has_due_time"]=> string(1) "0" ["added"]=> string(20) "2011-02-02T05:45:04Z" ["completed"]=> string(20) "2011-02-03T02:32:00Z" ["deleted"]=> string(0) "" ["priority"]=> string(1) "N" ["postponed"]=> string(1) "0" ["estimate"]=> string(0) "" } } } } } }
     
     
    Anyone know the code i can use to simply get the "name" keys from the complex array below.
     
    I've created a movie to show what I'm trying to achieve, please click below to view:
    http://screenr.com/XIY
     
     
    MOD EDIT: formatted text to get rid of errant smilies  . . .

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.