String into array

Ask about a PHP problem here.
Locked
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

String into array

Post by Temor »

I can really tell that I haven't been writing much code recently as I cannot even solve this simple problem.
Thankfully, I have you guys!

Here is an API output:

{"username":"Temor","balance":"102.73083724150007552344","total_earned":"284.25394566150007632000","total_hashrate":"919.25","workers":{"Temor.1":{"hashrate":"919.25"},"Temor.2":{"hashrate":"0.00"}},"24h_earnings":28.713264186831}



I wish to split this into an array, and have done so successfully, but the problem occurs at "workers". I want it to be a separate array, containing the workers information.

Could anyone guide me in the right direction here? ( I'll probably be able to do this myself after I've refreshed my brain a bit. I'm just stuck right now :P )
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: String into array

Post by Temor »

It took me this long to figure out that the output was JSON.
Speedy brain! Speedy.

SOLVED :D
User avatar
Helx
Posts: 350
Joined: Thu May 17, 2012 6:45 am
Location: Auckland, New Zealand

Re: String into array

Post by Helx »

Only 19 hours.
New record. :P
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: String into array

Post by Temor »

All I had to do was get a few hours of sleep and it all came back to me :)
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: String into array

Post by EcazS »

Temor wrote:All I had to do was get a few hours of sleep and it all came back to me :)

That's the normal problem. Debugging ain't possible unless you sleep first.
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: String into array

Post by Temor »

I tend to forget things like that if I haven't been coding actively for a while.
But it feels soooo good coming back to a piece of code that you've written but have no idea what it does and figuring it out :D


/Edit, this thread is going a bit of topic now. Locking it to avoid a total derail!! :)
Locked