Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Author Topic: Anyone good with PHP associative arrays?  (Read 1006 times)

broadstairs

  • Kitizen
  • ****
  • Posts: 3709
Anyone good with PHP associative arrays?
« on: July 08, 2024, 11:59:12 AM »

I have the following which is json data and using PHP json_decode it translates to the shown associative arrays, what I need to do is to then access each individual value but so far nothing I tried worked!

Code: [Select]
json string is:-

$jsonstr = {"daily":[[1717545600000,0.0],[1717632000000,0.0]]};

and is decoded to this by doing:-

$outjson = json_decode($jsonstr, true);

and printed by

print_r($outjson);

which gives this:-

Array
(
    [daily] => Array
        (
            [0] => Array
                (
                    [0] => 1717545600000
                    [1] => 0
                )

            [1] => Array
                (
                    [0] => 1717632000000
                    [1] => 0
                )

        )

)


Initially I'd be happy to just use the echo command in PHP to display each value.

Stuart
Logged
ISP:Vodafone Router:Vodafone Wi-Fi hub FTTP

broadstairs

  • Kitizen
  • ****
  • Posts: 3709
Re: Anyone good with PHP associative arrays?
« Reply #1 on: July 08, 2024, 12:27:43 PM »

I think I have sussed it! I'll do some more digging and prove it and if I am correct I'll explain how to do it in case anyone needs to know  ;)

Stuart
Logged
ISP:Vodafone Router:Vodafone Wi-Fi hub FTTP
 

anything