Quote

Parse error: syntax error, unexpected T_FUNCTION, expecting T_STRING in /external/thatswhatshesaid/mlevet.techmastertelecom.com/public_html/Function.php on line 2

My code is below. Thanks in advance for all help!

<?php class Function{ /* Array of coefficients for polynomial Starts from x^n to k If you do not want value for term, use 0 */ private $coefficients; public function __construct(array $coefs){ $this->$coefficients = $coefs; } public function __construct(){ $this->__construct(array(0, 0, 0)); } public function setCoefficients($coefs){ $this->$coefficients = $coefs; } public function getCoefficients(){return $this->$coefficients;} public function differentiate(){ $arrlen = sizeof($this->$coefficients); if($arrlen == 0) return new Function(); $coefs = array_values($this->$coefficients); $coefs[$arrlen-1] = 0; //remove constant $maxpower = $arrlen-1; $notZero = false; for($i = $arrlen-2; $i > -1; $i--){ if($coefs[$i] != 0){ $coefs[$i] = ($maxpower-$i)*$coefs[$i]; //power rule $notZero = true; //flag that we have not 0 function }//end if }//end for if($notZero == false) return new Function(); return new Function($coefs); }//end differentiate public function integrate(){ $arrlen = sizeof($this->$coefficients); if($arrlen == 0) return NULL; $coefs = array_values($this->$coefficients); $coefs[] = 0; //append placeholder for constant for($i = 0; $i < $arrlen; $i++){ if($coefs[$i] != 0){ $coefs[$i] /= ($arrlen-$i); } }//end for return new Function($coefs); }//end integrate public function toString(){ $string = ""; $arrlen = sizeof($this->$coefficients); if($arrlen == 0) return "0"; $maxpower = $arrlen-1; for($i = 0; $i < $arrlen; $i++){ if($this->$coefficients[$i] != 0) $string = $string . $this->$coefficients[$i] . "x^".($maxpower-$i); } return $string; }//end toString() public function toRow(){ $string = "<tr>"; for($this->$coefficients as $x){ $string = $string . "<td>" . $x . "</td>"; } $string = $string . "<td>". toString() . "</td>"; //first derivative $temp = differentiate(); $string = $string . "<td>". $temp->toString() . "</td>"; //second derivative $temp = $temp->differentiate(); $string = $string . "<td>" . temp->toString() . "</td>"; //integral $temp = integrate(); $string = $string . "<td>" . $temp->toString() . "</td>"; //end row $string = $string."</tr>"; } }//end class ?> <html> <head><title>Levet PHP Test</title></head> <body> <table> <?php $array = (-2, -1, 0, 1, 2); for($i = 0; $i < sizeof($array); $i++){ for($j = 0; $j < sizeof($array); $j++){ for($k = 0; $k < sizeof($array); $k++){ $temp = new Function($array[$i], $array[$j], $array[$k]); echo $temp->toRow(); }//end $k }//end $j }//end $i ?> </table> </body> </html>