Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#1

[PHP] Array in Parameterliste

  Alt 13. Jul 2009, 10:20
Ich habe folgende Funktion:
Code:
    private function cellSetup($backgroundColor, $textColor, $borderWidth, $borderColor)
    {
        $this->pdf->SetFillColor($backgroundColor[0], $backgroundColor[1], $backgroundColor[2]);
        $this->pdf->SetTextColor($textColor);
        $this->pdf->SetDrawColor($borderColor);
        $this->pdf->SetLineWidth($borderWidth);
    }
$backgroundColor ist, wie man sehen kann ein Array mit drei Werten. Aufrufen tue ich die Funktion so:
Code:
$backgroundColor = array(200, 200, 200);
$this->cellSetup($backgroundColor, 0, .3, 0);
Bekommt man das auch eleganter hin?

Ich hatte es mal so probiert:
Code:
$this->cellSetup($backgroundColor[200, 200, 200], 0, .3, 0);
Doch diese Syntax wollte er nicht akzeptieren.

Das Problem ist, ich muss eben einen Farbwert in seinen RGB Werten übergeben.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat