Shortening variables etc in php

Associate
Joined
4 Mar 2007
Posts
315
Location
United Kingdom
Ok so I have a problem, A class I am developing works flawlessly, however I would like to shorten some commands as the array's I am calling are too long.

Heres the current command to echo an array value:

PHP:
$xml->xmlAR->achievements[0]->achievement[$c]->iconClosed[0]

Is there any way that I can make this short hand. I know that iconClosed will be a constantly reference value, so my natural train of thought was to achieve something like this:

PHP:
$xml->xmlAR->$iconClosed;

but I cannot achieve this as I know it's a string to variable etc.
Is there any other way I can do this?
 
ahh thought that was bad practice, would you then say write another class containing all of these?
Theres like 20 in total all doing various jobs ofc.

Just tested it works a treat thanks.
 
Back
Top Bottom