Jump to content

Array Assistance


Pyr3x

Recommended Posts

I have an array here that looks like this:

 

Array
(
    [server_info] => Array
        (
            [up] => 1
            [up_since] => Sun, 23 Oct 2011 04:04:01 -0600
            [up_for] => 2588
            [version] => Beta 1.9 Prerelease 4
        )

    [players] => Array
        (
            [0] => Pyr3x
        )

    [server_settings] => Array
        (
            [map] => Underworld
            [pvp] => 1
            [pve] => 1
            [max] => 50
        )

    [admins] => 
    [ops] => Array
        (
        )

)

 

How would I for example print the contents of the players array without having to be specific on which object within it that I wish to print, it's dynamic so it's always going to change.

 

Example of the output I'd like is:

 

Players: Pyr3x, SomeGuy, AnotherGuy

 

Thank you for any help you may be able to provide.

 

-Pyr3x

Link to comment
https://forums.phpfreaks.com/topic/249629-array-assistance/
Share on other sites

That is awesome! Thank you sir!

 

One last question if that is OK.

 

How would I grab clean data from the field:

 

Array
(
    [server_info] => Array
        (
            [up] => 1
            [up_since] => Sun, 23 Oct 2011 04:04:01 -0600
            [up_for] => 2588
            [version] => Beta 1.9 Prerelease 4
        )
}

 

 

Example: [up_for]

 

Also how do I convert that value to hours:min:seconds

Link to comment
https://forums.phpfreaks.com/topic/249629-array-assistance/#findComment-1281654
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.