I have three objects:
result_set (stores the entire list of results for each webpage)
result_field (stores each row of the result set)
result_cell (stores each cell in each row)
Inside result_cell, I'm trying to find out what position (ie. what column) the current result_cell object is.
I have the following code (which I can't yet test as I've got a lot of code to finish before I can):
Code: Select all
//Stores a copy of the cells array stored in the parent object (result_field) of this result_cell object
private $parent_cells_array=$this->parent_result_field->cells_array;
/*Traverses through the cells array to see which position (column) this cell object is located in the result set */
for($i=0; $i<sizeof($parent_cells_array); $i++)
{
if($parent_cells_array[$i]===$this) //If array value is equal to exactly this object
{
$column_number=$i;
break;
}
}The above code is called inside a display( ) method, so in between the display( ) method being called and the result_field in the parent object being created, something could change??