【发布时间】:2011-07-04 14:38:46
【问题描述】:
我收到此错误: “PHP 解析错误:语法错误,第 66 行 /var/www/vhosts/... 中出现意外的 T_VARIABLE”
这是我的代码:
function combine($charArr, $k) {
$currentsize = sizeof($charArr);
static $combs = array();
static $originalsize = $currentsize; ###### <-- LINE 66 ######
static $firstcall = true;
if ($originalsize >= $k) {
# Get the First Combination
$comb = '';
if ($firstcall) { //if this is first call
for ($i = $originalsize-$k; $i < $originalsize; $i++) {
$comb .= $charArr[$i];
}
$combs[] = $comb; //append the first combo to the output array
$firstcall = false; //we only want to do this during the first iteration
}
....
....
}
知道有什么问题吗?
【问题讨论】:
-
为什么 $originalsize 在每次函数调用时都立即覆盖它的值是静态的?
标签: php syntax-error parse-error