Pass variable to a class which extends another one
<p>I'm using tFPDF class.</p>

<p>I'm extending this class using this code to get custom Header and Footer</p>

<pre><code>class PDF extends tFPDF{
    function Header(){
        $this-&gt;Image('../../images/logo-admin.png',10,6,30);

        $this-&gt;SetFont('DejaVu','',13);
        $this-&gt;Cell(247,10,$produto,0,0,'C',false);

        $this-&gt;SetDrawColor(0,153,204);
        $this-&gt;SetFillColor(98,197,230);
        $this-&gt;SetTextColor(255);
        $this-&gt;Cell(30,10,date('d/m/Y'),1,0,'C',true);

        $this-&gt;Ln(20);
    }

    function Footer(){
        $this-&gt;SetY(-15);
        $this-&gt;SetFont('Arial','',8);
        $this-&gt;Cell(0,10,'P'.chr(225).'gina '.$this-&gt;PageNo().'/{nb}',0,0,'C');
    }
}
</code></pre>

<p>What I need to do, is to somehow change the <code>$produto</code> with a variable that doesn't belong to the class.</p>

<p>I'm calling this class using <code>$pdf = new PDF();</code>.</p>

<p>How may I pass a variable to this class so I can use a string, something like <code>$pdf = new PDF('SomeString');</code> and use it inside the class like <code>$this-&gt;somestring = $somestringfromoutside</code></p>
