2

here is the output of a var_dump of my variable $result

stdClass Object(
    [20365924] => stdClass Object(
        [id] => 20365924
        [name] => Jack
        [profileIconId] => 916
        [summonerLevel] => 30
        [revisionDate] => 1463062452000
    )
)

how to save only the '916' inside a variable, i have tried many things without success...

thanx.

Chin Leung
  • 14,621
  • 3
  • 34
  • 58
B.Kevin
  • 250
  • 3
  • 12

2 Answers2

1

You can access it like this :

PHP

$variable = $result->20365924->profileIconId;
Sofiene Djebali
  • 4,398
  • 1
  • 21
  • 27
1

You could try with this if 20365924 is a name

$var = $result['20365924'][profileIconId];

or this if 20365924 is an index

$var = $result[20365924][profileIconId];

Hope it helps.

EDIT: Grammar

cthefinal
  • 79
  • 1