PHP -在函数中使用数组并得到未定义索引错误


PHP - using Array in a function and getting Undefined Index error

我使用的是旧代码,在php4上工作,但我得到一个未定义的索引通知,函数在php5中不工作

我有一个数组

$tabStdDVD = array( 
485=>array ('nom'=>"Studio 1",'reduc'=>"0",'delais'=>"4",'rayon'=>"H 2",'valide'=>"1",'valide_dvd_promo'=>"0",'valide_dvd'=>"1"), 
319=>array ('nom'=>"un deuxieme tudio",'reduc'=>"0",'delais'=>"2",'rayon'=>"I2-6",'valide'=>"1",'valide_dvd_promo'=>"0",'valide_dvd'=>"1"),);

当我试图在以下函数中使用它时:

function studio($idStd,$typeS){
global $tabStdDVD;
 $res=$tabStdDVD[$idStd][$typeS] ;
return $res;
}

这个函数没有工作,我得到一个通知:未定义的索引"在我的apache错误日志。

我认为这是一个全局数组问题或类似的…

谢谢你的帮助

好了,我知道为什么了。

我需要调用函数与我的数组参数..

studio($tabStdDVD,$idStd,$TypeS)

和my function中的

function studio($tabStdDVD,$idStd,$typeS) 
{..}