解析错误:意外的T_OBJECT_OPERATOR

时间:2014-07-17 16:37:21

标签: php parsing parse-error php-parse-error

我在第16行收到以下解析错误:'语法错误,意外T_STRING'。话虽如此,下面的代码块使用PHP 5.4.16正确解析,但是,PHP 4.4.9无法正确解析。想法?

对我来说,错误表明PHP 4.4.9中不支持interface关键字,但是,我在PHP的更改日志中找不到。

interface iA { // line 16
  public function methodA();
  public function methodB();
  public function methodC();
}

编辑(提供完整代码段)

<?php

// a comment.
// a comment.
// a comment.
// a comment.
// a comment.
// a comment.

// a comment.
if (!defined('PRODUCT_ENV')) {
  exit;
}

// a comment.
interface iA {
  public function methodA();
  public function methodB();
  public function methodC();
}

include(PRODUCT_PWD . PRODUCT_IMPLES . 'anotherfile.php');

1 个答案:

答案 0 :(得分:3)

请查看PHP手册New Object Model章节的Migrating from PHP 4 to PHP 5.0.x部分。旧的PHP / 4对象模型的文档已移至Classes and Objects (PHP 4)附录。

PHP / 5恰好在10年前(2004年7月)发布,因此很难在任何地方找到对PHP 4的支持。