• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

PHP/json problem

clouf

Active Member
Joined
Jul 5, 2012
Messages
191
Reaction score
34
Location
Poland
Hello my .php file print this json array
Code:
Array ( [nemerianos] => Array ( [id] => 19306628 [name] => Nemerianos [profileIconId] => 20 [summonerLevel] => 30 [revisionDate] => 1420993793000 ) )

How to make variable with this id numer 19306628 in php?
 
Hello my .php file print this json array
Code:
Array ( [nemerianos] => Array ( [id] => 19306628 [name] => Nemerianos [profileIconId] => 20 [summonerLevel] => 30 [revisionDate] => 1420993793000 ) )

How to make variable with this id numer 19306628 in php?

Not a json array?
Use like $array['nemerianos']['id']
 
I have another problem with a multi-dimensional array how to set variable for 235hilp3sl?

Code:
Array ( [19306628] => Array ( [summonerId] => 19306628 [pages] => Array ( [0] => Array ( [id] => 31230621 [name] => 235hilp3sl [current] => [slots] => Array ( [0] => Array ( [runeSlotId] => 1 [runeId] => 5273 ) [1] => Array ( [runeSlotId] => 2 [runeId] => 5273 ) [2] => Array ( [runeSlotId] => 3 [runeId] => 5273 ) [3] => Array ( [runeSlotId] => 4 [runeId] => 5273 ) [4] => Array ( [runeSlotId] => 5 [runeId] => 5273 ) [5] => Array ( [runeSlotId] => 6 [runeId] => 5273 ) [6] => Array ( [runeSlotId] => 7 [runeId] => 5273 ) [7] => Array ( [runeSlotId] => 8 [runeId] => 5273 ) [8] => Array ( [runeSlotId] => 9 [runeId] => 5273 ) [9] => Array ( [runeSlotId] => 10 [runeId] => 5317 ) [10] => Array ( [runeSlotId] => 11 [runeId] => 5328 ) [11] => Array ( [runeSlotId] => 12 [runeId] => 5328 ) [12] => Array ( [runeSlotId] => 13 [runeId] => 5328 ) [13] => Array ( [runeSlotId] => 14 [runeId] => 5317 ) [14] => Array ( [runeSlotId] => 15 [runeId] => 5317 ) [15] => Array ( [runeSlotId] => 16 [runeId] => 5317 ) [16] => Array ( [runeSlotId] => 17 [runeId] => 5317 ) [17] => Array ( [runeSlotId] => 18 [runeId] => 5317 ) [18] => Array ( [runeSlotId] => 19 [runeId] => 5298 ) [19] => Array ( [runeSlotId] => 20 [runeId] => 5298 ) [20] => Array ( [runeSlotId] => 21 [runeId] => 5298 ) [21] => Array ( [runeSlotId] => 22 [runeId] => 5298 ) [22] => Array ( [runeSlotId] => 23 [runeId] => 5298 ) [23] => Array ( [runeSlotId] => 24 [runeId] => 5298 ) [24] => Array ( [runeSlotId] => 25 [runeId] => 5298 ) [25] => Array ( [runeSlotId] => 26 [runeId] => 5297 ) [26] => Array ( [runeSlotId] => 27 [runeId] => 5297 ) [27] => Array ( [runeSlotId] => 28 [runeId] => 5347 ) [28] => Array ( [runeSlotId] => 29 [runeId] => 5357 ) [29] => Array ( [runeSlotId] => 30 [runeId] => 5357 ) ) ) [1] => Array ( [id] => 31230622 [name] => AD + ATTACK SPEED [current] => 1 [slots] => Array ( [0] => Array ( [runeSlotId] => 1 [runeId] => 5245 ) [1] => Array ( [runeSlotId] => 2 [runeId] => 5245 ) [2] => Array ( [runeSlotId] => 3 [runeId] => 5245 ) [3] => Array ( [runeSlotId] => 4 [runeId] => 5245 ) [4] => Array ( [runeSlotId] => 5 [runeId] => 5245 ) [5] => Array ( [runeSlotId] => 6 [runeId] => 5245 ) [6] => Array ( [runeSlotId] => 7 [runeId] => 5245 ) [7] => Array ( [runeSlotId] => 8 [runeId] => 5245 ) [8] => Array ( [runeSlotId] => 9 [runeId] => 5245 ) [9] => Array ( [runeSlotId] => 10 [runeId] => 5317 ) [10] => Array ( [runeSlotId] => 11 [runeId] => 5317 ) [11] => Array ( [runeSlotId] => 12 [runeId] => 5317 ) [12] => Array ( [runeSlotId] => 13 [runeId] => 5317 ) [13] => Array ( [runeSlotId] => 14 [runeId] => 5317 ) [14] => Array ( [runeSlotId] => 15 [runeId] => 5317 ) [15] => Array ( [runeSlotId] => 16 [runeId] => 5317 ) [16] => Array ( [runeSlotId] => 17 [runeId] => 5317 ) [17] => Array ( [runeSlotId] => 18 [runeId] => 5317 ) [18] => Array ( [runeSlotId] => 19 [runeId] => 5277 ) [19] => Array ( [runeSlotId] => 20 [runeId] => 5277 ) [20] => Array ( [runeSlotId] => 21 [runeId] => 5277 ) [21] => Array ( [runeSlotId] => 22 [runeId] => 5277 ) [22] => Array ( [runeSlotId] => 23 [runeId] => 5277 ) [23] => Array ( [runeSlotId] => 24 [runeId] => 5277 ) [24] => Array ( [runeSlotId] => 25 [runeId] => 5275 ) [25] => Array ( [runeSlotId] => 26 [runeId] => 5289 ) [26] => Array ( [runeSlotId] => 27 [runeId] => 5289 ) [27] => Array ( [runeSlotId] => 28 [runeId] => 5337 ) [28] => Array ( [runeSlotId] => 29 [runeId] => 5347 ) [29] => Array ( [runeSlotId] => 30 [runeId] => 5337 ) ) ) [2] => Array ( [id] => 31230623 [name] => AD [current] => [slots] => Array ( [0] => Array ( [runeSlotId] => 1 [runeId] => 5245 ) [1] => Array ( [runeSlotId] => 2 [runeId] => 5245 ) [2] => Array ( [runeSlotId] => 3 [runeId] => 5245 ) [3] => Array ( [runeSlotId] => 4 [runeId] => 5245 ) [4] => Array ( [runeSlotId] => 5 [runeId] => 5245 ) [5] => Array ( [runeSlotId] => 6 [runeId] => 5245 ) [6] => Array ( [runeSlotId] => 7 [runeId] => 5245 ) [7] => Array ( [runeSlotId] => 8 [runeId] => 5245 ) [8] => Array ( [runeSlotId] => 9 [runeId] => 5245 ) [9] => Array ( [runeSlotId] => 10 [runeId] => 5317 ) [10] => Array ( [runeSlotId] => 11 [runeId] => 5317 ) [11] => Array ( [runeSlotId] => 12 [runeId] => 5317 ) [12] => Array ( [runeSlotId] => 13 [runeId] => 5317 ) [13] => Array ( [runeSlotId] => 14 [runeId] => 5317 ) [14] => Array ( [runeSlotId] => 15 [runeId] => 5317 ) [15] => Array ( [runeSlotId] => 16 [runeId] => 5317 ) [16] => Array ( [runeSlotId] => 17 [runeId] => 5317 ) [17] => Array ( [runeSlotId] => 18 [runeId] => 5317 ) [18] => Array ( [runeSlotId] => 19 [runeId] => 5287 ) [19] => Array ( [runeSlotId] => 20 [runeId] => 5287 ) [20] => Array ( [runeSlotId] => 21 [runeId] => 5275 ) [21] => Array ( [runeSlotId] => 22 [runeId] => 5287 ) [22] => Array ( [runeSlotId] => 23 [runeId] => 5289 ) [23] => Array ( [runeSlotId] => 24 [runeId] => 5289 ) [24] => Array ( [runeSlotId] => 25 [runeId] => 5289 ) [25] => Array ( [runeSlotId] => 26 [runeId] => 5289 ) [26] => Array ( [runeSlotId] => 27 [runeId] => 5289 ) [27] => Array ( [runeSlotId] => 28 [runeId] => 5335 ) [28] => Array ( [runeSlotId] => 29 [runeId] => 5335 ) [29] => Array ( [runeSlotId] => 30 [runeId] => 5335 ) ) ) [3] => Array ( [id] => 62023759 [name] => HAHAHAHA [current] => [slots] => Array ( [0] => Array ( [runeSlotId] => 1 [runeId] => 5273 ) [1] => Array ( [runeSlotId] => 2 [runeId] => 5273 ) [2] => Array ( [runeSlotId] => 3 [runeId] => 5273 ) [3] => Array ( [runeSlotId] => 4 [runeId] => 5273 ) [4] => Array ( [runeSlotId] => 5 [runeId] => 5273 ) [5] => Array ( [runeSlotId] => 6 [runeId] => 5273 ) [6] => Array ( [runeSlotId] => 7 [runeId] => 5273 ) [7] => Array ( [runeSlotId] => 8 [runeId] => 5273 ) [8] => Array ( [runeSlotId] => 9 [runeId] => 5273 ) [9] => Array ( [runeSlotId] => 10 [runeId] => 5328 ) [10] => Array ( [runeSlotId] => 11 [runeId] => 5328 ) [11] => Array ( [runeSlotId] => 12 [runeId] => 5328 ) [12] => Array ( [runeSlotId] => 13 [runeId] => 5328 ) [13] => Array ( [runeSlotId] => 14 [runeId] => 5328 ) [14] => Array ( [runeSlotId] => 15 [runeId] => 5328 ) [15] => Array ( [runeSlotId] => 16 [runeId] => 5328 ) [16] => Array ( [runeSlotId] => 17 [runeId] => 5328 ) [17] => Array ( [runeSlotId] => 18 [runeId] => 5328 ) [18] => Array ( [runeSlotId] => 19 [runeId] => 5289 ) [19] => Array ( [runeSlotId] => 20 [runeId] => 5289 ) [20] => Array ( [runeSlotId] => 21 [runeId] => 5289 ) [21] => Array ( [runeSlotId] => 22 [runeId] => 5289 ) [22] => Array ( [runeSlotId] => 23 [runeId] => 5289 ) [23] => Array ( [runeSlotId] => 24 [runeId] => 5289 ) [24] => Array ( [runeSlotId] => 25 [runeId] => 5289 ) [25] => Array ( [runeSlotId] => 26 [runeId] => 5289 ) [26] => Array ( [runeSlotId] => 27 [runeId] => 5289 ) [27] => Array ( [runeSlotId] => 28 [runeId] => 5357 ) [28] => Array ( [runeSlotId] => 29 [runeId] => 5357 ) [29] => Array ( [runeSlotId] => 30 [runeId] => 5357 ) ) ) ) ) )
 
I have another problem with a multi-dimensional array how to set variable for 235hilp3sl?

Code:
Array ( [19306628] => Array ( [summonerId] => 19306628 [pages] => Array ( [0] => Array ( [id] => 31230621 [name] => 235hilp3sl [current] => [slots] => Array ( [0] => Array ( [runeSlotId] => 1 [runeId] => 5273 ) [1] => Array ( [runeSlotId] => 2 [runeId] => 5273 ) [2] => Array ( [runeSlotId] => 3 [runeId] => 5273 ) [3] => Array ( [runeSlotId] => 4 [runeId] => 5273 ) [4] => Array ( [runeSlotId] => 5 [runeId] => 5273 ) [5] => Array ( [runeSlotId] => 6 [runeId] => 5273 ) [6] => Array ( [runeSlotId] => 7 [runeId] => 5273 ) [7] => Array ( [runeSlotId] => 8 [runeId] => 5273 ) [8] => Array ( [runeSlotId] => 9 [runeId] => 5273 ) [9] => Array ( [runeSlotId] => 10 [runeId] => 5317 ) [10] => Array ( [runeSlotId] => 11 [runeId] => 5328 ) [11] => Array ( [runeSlotId] => 12 [runeId] => 5328 ) [12] => Array ( [runeSlotId] => 13 [runeId] => 5328 ) [13] => Array ( [runeSlotId] => 14 [runeId] => 5317 ) [14] => Array ( [runeSlotId] => 15 [runeId] => 5317 ) [15] => Array ( [runeSlotId] => 16 [runeId] => 5317 ) [16] => Array ( [runeSlotId] => 17 [runeId] => 5317 ) [17] => Array ( [runeSlotId] => 18 [runeId] => 5317 ) [18] => Array ( [runeSlotId] => 19 [runeId] => 5298 ) [19] => Array ( [runeSlotId] => 20 [runeId] => 5298 ) [20] => Array ( [runeSlotId] => 21 [runeId] => 5298 ) [21] => Array ( [runeSlotId] => 22 [runeId] => 5298 ) [22] => Array ( [runeSlotId] => 23 [runeId] => 5298 ) [23] => Array ( [runeSlotId] => 24 [runeId] => 5298 ) [24] => Array ( [runeSlotId] => 25 [runeId] => 5298 ) [25] => Array ( [runeSlotId] => 26 [runeId] => 5297 ) [26] => Array ( [runeSlotId] => 27 [runeId] => 5297 ) [27] => Array ( [runeSlotId] => 28 [runeId] => 5347 ) [28] => Array ( [runeSlotId] => 29 [runeId] => 5357 ) [29] => Array ( [runeSlotId] => 30 [runeId] => 5357 ) ) ) [1] => Array ( [id] => 31230622 [name] => AD + ATTACK SPEED [current] => 1 [slots] => Array ( [0] => Array ( [runeSlotId] => 1 [runeId] => 5245 ) [1] => Array ( [runeSlotId] => 2 [runeId] => 5245 ) [2] => Array ( [runeSlotId] => 3 [runeId] => 5245 ) [3] => Array ( [runeSlotId] => 4 [runeId] => 5245 ) [4] => Array ( [runeSlotId] => 5 [runeId] => 5245 ) [5] => Array ( [runeSlotId] => 6 [runeId] => 5245 ) [6] => Array ( [runeSlotId] => 7 [runeId] => 5245 ) [7] => Array ( [runeSlotId] => 8 [runeId] => 5245 ) [8] => Array ( [runeSlotId] => 9 [runeId] => 5245 ) [9] => Array ( [runeSlotId] => 10 [runeId] => 5317 ) [10] => Array ( [runeSlotId] => 11 [runeId] => 5317 ) [11] => Array ( [runeSlotId] => 12 [runeId] => 5317 ) [12] => Array ( [runeSlotId] => 13 [runeId] => 5317 ) [13] => Array ( [runeSlotId] => 14 [runeId] => 5317 ) [14] => Array ( [runeSlotId] => 15 [runeId] => 5317 ) [15] => Array ( [runeSlotId] => 16 [runeId] => 5317 ) [16] => Array ( [runeSlotId] => 17 [runeId] => 5317 ) [17] => Array ( [runeSlotId] => 18 [runeId] => 5317 ) [18] => Array ( [runeSlotId] => 19 [runeId] => 5277 ) [19] => Array ( [runeSlotId] => 20 [runeId] => 5277 ) [20] => Array ( [runeSlotId] => 21 [runeId] => 5277 ) [21] => Array ( [runeSlotId] => 22 [runeId] => 5277 ) [22] => Array ( [runeSlotId] => 23 [runeId] => 5277 ) [23] => Array ( [runeSlotId] => 24 [runeId] => 5277 ) [24] => Array ( [runeSlotId] => 25 [runeId] => 5275 ) [25] => Array ( [runeSlotId] => 26 [runeId] => 5289 ) [26] => Array ( [runeSlotId] => 27 [runeId] => 5289 ) [27] => Array ( [runeSlotId] => 28 [runeId] => 5337 ) [28] => Array ( [runeSlotId] => 29 [runeId] => 5347 ) [29] => Array ( [runeSlotId] => 30 [runeId] => 5337 ) ) ) [2] => Array ( [id] => 31230623 [name] => AD [current] => [slots] => Array ( [0] => Array ( [runeSlotId] => 1 [runeId] => 5245 ) [1] => Array ( [runeSlotId] => 2 [runeId] => 5245 ) [2] => Array ( [runeSlotId] => 3 [runeId] => 5245 ) [3] => Array ( [runeSlotId] => 4 [runeId] => 5245 ) [4] => Array ( [runeSlotId] => 5 [runeId] => 5245 ) [5] => Array ( [runeSlotId] => 6 [runeId] => 5245 ) [6] => Array ( [runeSlotId] => 7 [runeId] => 5245 ) [7] => Array ( [runeSlotId] => 8 [runeId] => 5245 ) [8] => Array ( [runeSlotId] => 9 [runeId] => 5245 ) [9] => Array ( [runeSlotId] => 10 [runeId] => 5317 ) [10] => Array ( [runeSlotId] => 11 [runeId] => 5317 ) [11] => Array ( [runeSlotId] => 12 [runeId] => 5317 ) [12] => Array ( [runeSlotId] => 13 [runeId] => 5317 ) [13] => Array ( [runeSlotId] => 14 [runeId] => 5317 ) [14] => Array ( [runeSlotId] => 15 [runeId] => 5317 ) [15] => Array ( [runeSlotId] => 16 [runeId] => 5317 ) [16] => Array ( [runeSlotId] => 17 [runeId] => 5317 ) [17] => Array ( [runeSlotId] => 18 [runeId] => 5317 ) [18] => Array ( [runeSlotId] => 19 [runeId] => 5287 ) [19] => Array ( [runeSlotId] => 20 [runeId] => 5287 ) [20] => Array ( [runeSlotId] => 21 [runeId] => 5275 ) [21] => Array ( [runeSlotId] => 22 [runeId] => 5287 ) [22] => Array ( [runeSlotId] => 23 [runeId] => 5289 ) [23] => Array ( [runeSlotId] => 24 [runeId] => 5289 ) [24] => Array ( [runeSlotId] => 25 [runeId] => 5289 ) [25] => Array ( [runeSlotId] => 26 [runeId] => 5289 ) [26] => Array ( [runeSlotId] => 27 [runeId] => 5289 ) [27] => Array ( [runeSlotId] => 28 [runeId] => 5335 ) [28] => Array ( [runeSlotId] => 29 [runeId] => 5335 ) [29] => Array ( [runeSlotId] => 30 [runeId] => 5335 ) ) ) [3] => Array ( [id] => 62023759 [name] => HAHAHAHA [current] => [slots] => Array ( [0] => Array ( [runeSlotId] => 1 [runeId] => 5273 ) [1] => Array ( [runeSlotId] => 2 [runeId] => 5273 ) [2] => Array ( [runeSlotId] => 3 [runeId] => 5273 ) [3] => Array ( [runeSlotId] => 4 [runeId] => 5273 ) [4] => Array ( [runeSlotId] => 5 [runeId] => 5273 ) [5] => Array ( [runeSlotId] => 6 [runeId] => 5273 ) [6] => Array ( [runeSlotId] => 7 [runeId] => 5273 ) [7] => Array ( [runeSlotId] => 8 [runeId] => 5273 ) [8] => Array ( [runeSlotId] => 9 [runeId] => 5273 ) [9] => Array ( [runeSlotId] => 10 [runeId] => 5328 ) [10] => Array ( [runeSlotId] => 11 [runeId] => 5328 ) [11] => Array ( [runeSlotId] => 12 [runeId] => 5328 ) [12] => Array ( [runeSlotId] => 13 [runeId] => 5328 ) [13] => Array ( [runeSlotId] => 14 [runeId] => 5328 ) [14] => Array ( [runeSlotId] => 15 [runeId] => 5328 ) [15] => Array ( [runeSlotId] => 16 [runeId] => 5328 ) [16] => Array ( [runeSlotId] => 17 [runeId] => 5328 ) [17] => Array ( [runeSlotId] => 18 [runeId] => 5328 ) [18] => Array ( [runeSlotId] => 19 [runeId] => 5289 ) [19] => Array ( [runeSlotId] => 20 [runeId] => 5289 ) [20] => Array ( [runeSlotId] => 21 [runeId] => 5289 ) [21] => Array ( [runeSlotId] => 22 [runeId] => 5289 ) [22] => Array ( [runeSlotId] => 23 [runeId] => 5289 ) [23] => Array ( [runeSlotId] => 24 [runeId] => 5289 ) [24] => Array ( [runeSlotId] => 25 [runeId] => 5289 ) [25] => Array ( [runeSlotId] => 26 [runeId] => 5289 ) [26] => Array ( [runeSlotId] => 27 [runeId] => 5289 ) [27] => Array ( [runeSlotId] => 28 [runeId] => 5357 ) [28] => Array ( [runeSlotId] => 29 [runeId] => 5357 ) [29] => Array ( [runeSlotId] => 30 [runeId] => 5357 ) ) ) ) ) )

235hilp3sl is a value set from the index "name".
To access it, use $array[19306628]['summonerId']['pages']['name'];
 
the last one array

Array ( [33543398] => Array ( [0] => Array ( [name] => Morgana's Ravagers [tier] => DIAMOND [queue] => RANKED_SOLO_5x5 [entries] => Array ( [0] => Array ( [playerOrTeamId] => 32665204 [playerOrTeamName] => Dodo the grey [division] => I [leaguePoints] => 22 [wins] => 318 [isHotStreak] => [isVeteran] => [isFreshBlood] => 1 [isInactive] => )

$array[33543398][0][division]
how to load it not like using id = [0], i want to use [playerOrTeamId]
example. Player with id 32665204 division is I
 
You are in the Open Tibia Support section.
You are asking for direct support on how to load specific data from the League of Legends API.
Its not even a general programming question.
This thread should be closed imo.
 
the last one array

Array ( [33543398] => Array ( [0] => Array ( [name] => Morgana's Ravagers [tier] => DIAMOND [queue] => RANKED_SOLO_5x5 [entries] => Array ( [0] => Array ( [playerOrTeamId] => 32665204 [playerOrTeamName] => Dodo the grey [division] => I [leaguePoints] => 22 [wins] => 318 [isHotStreak] => [isVeteran] => [isFreshBlood] => 1 [isInactive] => )

$array[33543398][0][division]
how to load it not like using id = [0], i want to use [playerOrTeamId]
example. Player with id 32665204 division is I
You can't use 32665204 to access an index of 0, since its not ot related I will not help you with this.. sorry :(
 
Back
Top