I have been trying to solve this problem for ages and with no luck . Could someone please help me out. I can add stuff to the array list as well but when I print the arrayList out it prints out some random text.
Just define the key you want. print_r just outputs the raw array/contents. You can print it out in a more readable way if you wrap your print_r in HTML < pre > tags.
Briefly looking at their API docs and the output you provided, it looks like they return an object that contains arrays. I personally don’t like working with mixed objects/arrays. I prefer to do one or the other but that’s just me.
You can try:
$character = $armory->getCharacter('Byzantia');
// For debugging purposes
echo "<pre>";
print_r($character);
echo "</pre>";
// Because they mix objects with arrays, which I personally don't like, we'll convert the object to an array with type casting, and trim off some of the outer layers
$brackets = (Array) $character['pvp']['brackets'];
// Print 2v2 info
echo "<pre>";
print_r($brackets['ARENA_BRACKET_2v2']);
echo "</pre>";
// Print RBG info
echo "<pre>";
print_r($brackets['ARENA_BRACKET_RBG']);
echo "</pre>";
According to your last output, it looks like it won’t be able to simply print_r the $character as he’s made a lot of the class properties private. So I’m assuming he’s provided accessor methods but the API documentation isn’t much in the way of documentation so I’m taking a guess that getBattlegrounds() is the one with the info you want.