Jump to content

Cannot Get Elements Out Of This...


Brute

Recommended Posts

print_r:

 

Array ( [public] => Array ( [currentVersion] => 162 [dedicated] => 1 [difficulty] => 1 [equalModRequired] => 0 [gameState] => 7 [gamemode] => openplaying [gamename] => arma2oapc [gametype] => RP [gamever] => 1.62.95251 [gq_address] => 85.236.98.102 [gq_dedicated] => 1 [gq_gametype] => RP [gq_hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com [gq_mapname] => tavi [gq_maxplayers] => 85 [gq_mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD [gq_numplayers] => 0 [gq_online] => 1 [gq_password] => 2 [gq_port] => 2302 [gq_protocol] => gamespy3 [gq_transport] => udp [gq_type] => armedassault2oa [hash] => BB57B402D92E05CF1B7EE1E351E45350449A929B [hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com [language] => 65545 [mapname] => tavi [maxplayers] => 85 [mission] => Life Project RPG [mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD [modhash] => 993414a99da37d9b35ea3cf165af19b319b26ec3;98c8b2464fa39ff1ac38ea7db8f96ea02e5ea76d;da39a3ee5e6b4b0d3255bfef95601890afd80709;8d15d603cca8999344e01c1719c293053db5962d;d5af993459674089a8da572ab84c0bb807769227;ad5168fec24a4ce539315483487ce472cb63c7d3;;01a7de012d75ad0f4adb45c885cb9c8ab2636963;PMC v. 1.02;BAF v. 1.03 [numplayers] => 0 [numteams] => 0 [param1] => 0 [param2] => 0 [password] => 2 [platform] => win [players] => Array ( ) [reqBuild] => 0 [reqSecureId] => 0 [requiredVersion] => 162 [signatures] => [sv_battleye] => 1 [teams] => Array ( ) [timelimit] => 15 [verifySignatures] => 0 ) )

 

I can't figure out how to get elements like gq_numplayers out by themselves so I can echo them.

Link to comment
https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/
Share on other sites

Array
(
   [public] => Array
       (
           [currentVersion] => 162
           [dedicated] => 1
           [difficulty] => 1
           [equalModRequired] => 0
           [gameState] => 7
           [gamemode] => openplaying
           [gamename] => arma2oapc
           [gametype] => RP
           [gamever] => 1.62.95251
           [gq_address] => 85.236.98.102
           [gq_dedicated] => 1
           [gq_gametype] => RP
           [gq_hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com
           [gq_mapname] => tavi
           [gq_maxplayers] => 85
           [gq_mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD
           [gq_numplayers] => 0
           [gq_online] => 1
           [gq_password] => 2
           [gq_port] => 2302
           [gq_protocol] => gamespy3
           [gq_transport] => udp
           [gq_type] => armedassault2oa
           [hash] => BB57B402D92E05CF1B7EE1E351E45350449A929B
           [hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com
           [language] => 65545
           [mapname] => tavi
           [maxplayers] => 85
           [mission] => Life Project RPG
           [mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD
           [modhash] => 993414a99da37d9b35ea3cf165af19b319b26ec3;98c8b2464fa39ff1ac38ea7db8f96ea02e5ea76d;da39a3ee5e6b4b0d3255bfef95601890afd80709;8d15d603cca8999344e01c1719c293053db5962d;d5af993459674089a8da572ab84c0bb807769227;ad5168fec24a4ce539315483487ce472cb63c7d3;;01a7de012d75ad0f4adb45c885cb9c8ab2636963;PMC v. 1.02;BAF v. 1.03
           [numplayers] => 0
           [numteams] => 0
           [param1] => 0
           [param2] => 0
           [password] => 2
           [platform] => win
           [players] => Array
               (
               )

           [reqBuild] => 0
           [reqSecureId] => 0
           [requiredVersion] => 162
           [signatures] => 
           [sv_battleye] => 1
           [teams] => Array
               (
               )

           [timelimit] => 15
           [verifySignatures] => 0
       )

)


 

That's what I've got, I still have to idea how to pull elements out of these arrays though :(

That works, thank you! However echo $results['public']['players']['0']['player']; that doesn't work for this:

 

Array
(
   [public] => Array
       (
           [currentVersion] => 162
           [dedicated] => 1
           [difficulty] => 1
           [equalModRequired] => 0
           [gameState] => 7
           [gamemode] => openplaying
           [gamename] => arma2oapc
           [gametype] => RP
           [gamever] => 1.62.95251
           [gq_address] => 85.236.98.102
           [gq_dedicated] => 1
           [gq_gametype] => RP
           [gq_hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com
           [gq_mapname] => tavi
           [gq_maxplayers] => 85
           [gq_mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD
           [gq_numplayers] => 1
           [gq_online] => 1
           [gq_password] => 2
           [gq_port] => 2302
           [gq_protocol] => gamespy3
           [gq_transport] => udp
           [gq_type] => armedassault2oa
           [hash] => BB57B402D92E05CF1B7EE1E351E45350449A929B
           [hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com
           [language] => 65545
           [mapname] => tavi
           [maxplayers] => 85
           [mission] => Life Project RPG
           [mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD
           [modhash] => 993414a99da37d9b35ea3cf165af19b319b26ec3;98c8b2464fa39ff1ac38ea7db8f96ea02e5ea76d;da39a3ee5e6b4b0d3255bfef95601890afd80709;8d15d603cca8999344e01c1719c293053db5962d;d5af993459674089a8da572ab84c0bb807769227;ad5168fec24a4ce539315483487ce472cb63c7d3;;01a7de012d75ad0f4adb45c885cb9c8ab2636963;PMC v. 1.02;BAF v. 1.03
           [numplayers] => 1
           [numteams] => 0
           [param1] => 0
           [param2] => 0
           [password] => 2
           [platform] => win
           [players] => Array
               (
                   [0] => Array
                       (
                           [player] => Polaris
                           [score] => 0
                           [deaths] => 0
                           [gq_name] => 
                           [gq_kills] => 
                           [gq_deaths] => 0
                           [gq_score] => 0
                           [gq_ping] => 
                       )

               )

           [reqBuild] => 0
           [reqSecureId] => 0
           [requiredVersion] => 162
           [signatures] => 
           [sv_battleye] => 1
           [teams] => Array
               (
               )

           [timelimit] => 15
           [verifySignatures] => 0
       )

)


Just noticed that. I didn't see it myself until I pasted his array to my editor.

 

I'm glad I wasn't the only one who noticed...might have been crazy :)

 

I can't see it in the browser but it is in the source...what the hell is that character lol.

 

echo $results['public']['players'][0]['player'];

 

That works :s

 

Most likely a byte-order mark or something. Wherever you make that array key, it's adding something in there. We'd need to see some code to help find it.

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.