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