Page 1 of 1

extra curly bracket error

Posted: Mon Jan 15, 2007 4:42 pm
by afbase
Parse error: syntax error, unexpected '{' in /home/clinton/hdd1/owl/project/project/stock/tests/stock_class.php on line 238
I can't seem to find a curly bracket error in my function that this error is referring to.

Code: Select all

function mysql_score(){
if( preg_match("!\d*.\d+!", $this->future_5_earnings[1]) && preg_match("!\d*.\d+!", $this->past_5_earnings[1])){
	$earnings = $this->future_5_earnings[1]*$this->past_5_earnings[1];
}
else{
	print  $this->ticker."doesn't have good earnings";
}


if( preg_match("!\d*.\d+!", $this->liabilities[1]) && preg_match("!!",$this->curass[1])){
	$finance = $this->curass[1] / $this->liabilities[1];
}
else{
	print $this->ticker."doesn't have liabilities or assets";
}


if( preg_match("!\d*.\d+!", $this->multiplier[1]) && preg_match("!\d*.\d+!", $this->bookval[1]){
	$pe = $this->multiplier[1] * $this->bookval[1];
	$inv_pe = 1 / $this->multiplier[1];
	$final_pe = $pe / $inv_pe;
}
else{
	print $this->ticker."needs a p/e or bookval";
}


$this->score = $earnings * $finance * $final_pe;
}
The error is referring to this particular line of code :
if( preg_match("!\d*.\d+!", $this->multiplier[1]) && preg_match("!\d*.\d+!", $this->bookval[1]){


does anybody see any problems with this class method???

Posted: Mon Jan 15, 2007 4:48 pm
by John Cartwright
Inline error checking and bracket matching are useful in IDE's.. I personally use Zend IDE nowadays..

Code: Select all

if( preg_match("!\d*.\d+!", $this->multiplier[1]) && preg_match("!\d*.\d+!", $this->bookval[1]){
Your not missing a curly bracket, the error states it ran into one unexpectantly. Your missing a ) in there, I'll let you figure out where :)

Posted: Mon Jan 15, 2007 4:53 pm
by afbase
haha thanks