Jump to content

"$this->" <---???


Dan_Mason

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.