Wow, that subject line looks goofy.
Ok, I have an object which has several properties that are arrays. I have a method which prints elements of those arrays by refercing the name of the property through a variable variable. The problem I am having is the reference. The reference has a structure like this:
$this->${$attrib_name}[0]
For this example:
class movie_class
{
var $name = array(); //The various names of the movie, such as "Return of the Jedi" is also known as "Revenge of the Jedi" and "Star Wars Episode VII"
var $cast = array(); //The various actors in the movie
var $year; //The year the movie came out
function movie_class()
{
//Normally the information is retrieved from a database but for illustration we will manually set it
$this->name = array("Return of the Jedi","Revenge of the Jedi","Star Wars Episode VII");
$this->cast = array("Harrison Ford","Carrie Fisher","Mark Hammill");
$this->year = 1982;
}
function print_firstitem($attrib_name)
{
$first_item = $this->${$attrib_name}[0];
if ($first_item) echo "$first_item";
}
}