Vote count:
0
I'm trying to turn Minecraft names into UUIDs, which can be converted into a "name history". I have the name->UUID part down pat, but the name history is getting an error.
Running this code, the $uuid variable contains an array of all the UUIDs I'm trying to convert into a name history - I then try to run all of them through the API, and depending on how many past names the user has, add » icons to signify a change. Unfortunately, with test data of something like this:
Foo
Bar (changed to Baz)
it outputs
Array | Array » Array |
, not the
Foo | Bar » Baz |
it's supposed to. I know I'm probably getting the array as an object, but I don't know where I would be doing that or how to get the element instead.
(and here's the code)
$uuid_real = json_decode($uuid, TRUE);
foreach($uuid_real as $uuid_totest){
$toadd = json_decode(file_get_contents('http://ift.tt/1IeqrdP' . $uuid_totest['id'] . '/names'), TRUE);
if(count($toadd)==1){
$results .= $toadd['0'] . " | ";
}elseif(count($toadd)==2){
$results .= $toadd['0'] . " » " . $toadd['1'] . " | ";
}elseif(count($toadd)==3){
$results .= $toadd['0'] . " » " . $toadd['1'] . " » " . $toadd['2'] . " | ";
}
asked 1 min ago
Array instead of Array Element
Aucun commentaire:
Enregistrer un commentaire