我从脚本中得到这个错误:
[Fri Apr 23 10:57:42 2010] [error] [client 10.0.0.1] PHP Fatal error: Cannot re-assign $this in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\abp\\fol\\test.php on line 27, referer: http://abp.bhc.com/fol/
下面是产生错误的代码:
$voiceboxes = array(
'141133' => array(
'title' => 'Title',
'1' => array(
'Title' => 'Title2',
'Link' => 'http://...',
),
'12' => array(
'Title' => 'Title3',
'Link' => 'http://...',
)
),
'1070453' => array(
'title' => 'Title4',
'1' => array(
'Title' => 'Title5',
'Link' => 'http://...',
)
)
);
$last = 0;
//$this = 0;
echo "
- \n";
foreach ($voiceboxes as $key => $value) {
$last = 0;
$this = null; //Error is thrown here, Line 27
//$voiceboxes[$key]['title']
echo "
- \n";
foreach ($value as $key2 => $value2) {
if ($key2 == 'title') {
echo "
$value2\n";} else {
$this = (int) $key2;
if ($this == $last + 1) {
echo '
';} else { '
';}$last = $key2;
echo $voiceboxes[$key][$key2]['Title'] . "
" . $voiceboxes[$key][$key2]['Link'] . '
}
}
echo "
\n";}