开发者

How to convert the ASP code snippet to PHP?

function isChongHao(ary,i,j)
    if ary(i-1,j)<>0 or ary(i+1,j) then
    开发者_开发百科    isChongHao=true
        exit function
    end if
    isChongHao=false
end function 


function isChongHao($ary, $i, $j) {
  if($ary[$i-1][$j] != 0 || $ary[$i+1][$j]) {
    return true;
  }
  return false;
}

--I suppose $ary contains a name of a function.--

Ooops, strike that: Joel thanks, I totally missed the fact that it was vbscript!!! O.o Now maybe it is better...


function isChongHao($ary, $i, $j)
{
    return ($ary[$i-1][$j] || $ary[$i+1][$j]);
 }

You should probably check to ensure those indexes are set in the array beforehand, though, with an isset() call.


Assuming ary is an array

function isChongHao($ary,$i,$j) {
    return (($ary[$i-1][$j] || $ary[$i+1][$j]) ? true : false);
}

Assuming ary is a function

function isChongHao($ary,$i,$j) {
    return (($ary($i-1,$j) || $ary($i+1,$j)) ? true : false);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜