2015-02-12 52 views
-1

嗨,大家好,我得到這個代碼的錯誤,我有這個功能的類Markets.php致命錯誤:無法使用類型泊松的對象數組

public function getUnder($line){ 
     $under = 0; 
     for($i=0; $i<= floor($line) ;$i++){ 
      for ($j=0; $j<= (floor($line) - $i);$j++){ 
        $under = $under + $this->poisson_tab[$i][$j]; 
      } 
     } 
     return $under; 
    } 

我試圖使用它像這樣:

$get_markets = new Markets($tab_poisson); 

echo "Under 2.5 -> ".(1/$get_markets->getUnder(2.5))."</br>"; 
+0

你能展示Markets類的代碼嗎? – 2015-02-12 03:08:44

回答

0

你的問題很模糊,但隨着信息你給我猜..

$this->poisson_tab[$i][$j]不應作爲數組引用,它應該作爲參考一個對象..像$this->poisson_tab->$i->$j$this->poisson_tab[$i]->$j取決於您的其他代碼。

相關問題