Bonjour,
J'aimerais classé les résultats de mon array sous forme de tableau et je ne sais pas du tout comment faire.
J'ai du mal avec les foreach alors si quelqu'un pourrait me donner la solution en m'expliquant histoire que je sâche a l'avenir :)

Voici l'array:

array(1) {
  ["response"]=>
  array(2) {
    ["game_count"]=>
    int(1)
    ["games"]=>
    array(1) {
      [0]=>
      array(3) {
        ["appid"]=>
        int(440)
        ["playtime_2weeks"]=>
        int(164)
        ["playtime_forever"]=>
        int(164)
        [1]=>
      array(3) {
        ["appid"]=>
        int(730)
        ["playtime_2weeks"]=>
        int(164)
        ["playtime_forever"]=>
        int(164)
        [2]=>
      array(3) {
        ["appid"]=>
        int(552)
        ["playtime_2weeks"]=>
        int(164)
        ["playtime_forever"]=>
        int(164)
      }
    }
  }
}

Je souhaiterais les résultats sous formes de tableau APP ID -- TEMP DE JEU (<2 Semaines) -- TEMP DE JEU (Total)

Mercii :D

1 réponse


Cobryn
Auteur
Réponse acceptée

Trouvé.

Solution:

<table >
    <thead>
        <tr>
            <th>APP ID</th>
            <th>PLAYTIME</th>
        </tr>
    </thead>
    <tbody>
        <?php
        foreach($steam->getOwnedGame()['response']['games'] as $key => $value) {
            ?>
        <tr>
            <td><?php echo $value['appid']; ?></td>
            <td><?php echo $value['playtime_forever']; ?></td>
        </tr>
        <?php } ?>
    </tbody>
</table>