Dan_Mason Posted November 3, 2008 Share Posted November 3, 2008 This is taken from "PHPlot" which is used for plotting graphs in php. I am trying to understand the source file, as i need to make a few alterations to the positioning of a graph. I would like to know what the $this-> variable is being used for, as i havent yet come across anything like this. function PHPlot($which_width=600, $which_height=400, $which_output_file=NULL, $which_input_file=NULL) { $this->SetRGBArray($this->color_array); $this->background_done = FALSE; // TRUE after background image is drawn once $this->plot_margins_set = FALSE; // TRUE with user-set plot area or plot margins. if ($which_output_file) $this->SetOutputFile($which_output_file); if ($which_input_file) $this->SetInputFile($which_input_file); else { $this->image_width = $which_width; $this->image_height = $which_height; $this->img = ImageCreate($this->image_width, $this->image_height); if (! $this->img) return $this->PrintError('PHPlot(): Could not create image resource.'); } $this->SetDefaultStyles(); $this->SetDefaultFonts(); $this->SetTitle(''); $this->SetXTitle(''); $this->SetYTitle(''); $this->print_image = TRUE; // Use for multiple plots per image (TODO: automatic) } (above is just an example of a function in the source code, taken from PHPlot.php from http://phplot.sourceforge.net) Link to comment https://forums.phpfreaks.com/topic/131165-this/ Share on other sites More sharing options...
Adam Posted November 3, 2008 Share Posted November 3, 2008 $this is a special variable in PHP used to access objects within a class.. the "->" operator is just used to access the child/parent of an object, say a function / method or a variable.. Link to comment https://forums.phpfreaks.com/topic/131165-this/#findComment-681013 Share on other sites More sharing options...
Dan_Mason Posted November 3, 2008 Author Share Posted November 3, 2008 Thankyou for the help! Link to comment https://forums.phpfreaks.com/topic/131165-this/#findComment-681019 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.