Forum Moderators: coopster
$this->minTagValue = min($this->KeywordsArray);
$this->maxTagValue = max($this->KeywordsArray);
$this->FontRatio = ($this->MaxFontSize - $this->MinFontSize) / ($this->maxTagValue - $this->minTagValue) ;
$this->FontOffset = $this->MaxFontSize - ($this->FontRatio * $this->maxTagValue );
I got the following errors :
Warning: min() [function.min]: Array must contain atleast one element
max() [function.max]: Array must contain atleast one element
Warning: Division by zero
to avoid the error i tried :
if ($this->KeywordsArray > 0) {
$this->minTagValue = min($this->KeywordsArray);
$this->maxTagValue = max($this->KeywordsArray);
$this->FontRatio = ($this->MaxFontSize - $this->MinFontSize) / ($this->maxTagValue - $this->minTagValue) ;
$this->FontOffset = $this->MaxFontSize - ($this->FontRatio * $this->maxTagValue );
}
else {
exit ('');
}
Could someone help me to fix this ?
Thanks
hanyaz
$this->minTagValue = min($this->KeywordsArray);
$this->maxTagValue = max($this->KeywordsArray);
$this->FontRatio = ($this->MaxFontSize - $this->MinFontSize) / ($this->maxTagValue - $this->minTagValue) ;
$this->FontOffset = $this->MaxFontSize - ($this->FontRatio * $this->maxTagValue );
} //array check ends
else
{
die("Not an Array");
}
try that, you can ofcourse move the "aray check end" to an upper line if You ve to.
[edited by: Anyango at 11:07 am (utc) on Nov. 15, 2008]