使用Math_Matrix PEAR库的意外T_CLONE

Ben*_*Ben 0 php pear matrix

我以前没用过PEAR,所以我可能会做一些愚蠢的事情.我已经安装了Math_Matrix库,但是当我包含它时,我只是得到一个错误.我的整个代码是这样的:

<?php
  $path = '/home/PEAR/Math_Matrix-0.8.0';
  set_include_path(get_include_path() . PATH_SEPARATOR . $path);
  include_once 'Matrix.php';
?>
Run Code Online (Sandbox Code Playgroud)

我得到的错误是这样的:

Parse error: syntax error, unexpected T_CLONE, expecting T_STRING in /home/PEAR/Math_Matrix-0.8.0/Matrix.php on line 272
Run Code Online (Sandbox Code Playgroud)

我真的不确定该怎么做.我想我能想到的解释是:

  1. 我没有正确安装Math_Matrix库(我在已经安装了PEAR的共享服务器上)或者已经下载了错误的版本.
  2. 在我加入Matrix.php之前,我应该包含其他内容
  3. 我已经包含了错误的文件(或正确的文件名,但错误的路径,不知何故).

要安装它,我做了以下事情:

pear install --alldeps channel://pear.phpunit.de/PHPUnit
pear install --alldeps channel://pear.php.net/Math_Vector-0.6.2
pear install Math_Matrix
Run Code Online (Sandbox Code Playgroud)

Gre*_*reg 5

从[Math_Matrix](http://pear.php.net/package/Math_Matrix主页)我可以看到它最后一次更新是在2003年.从那时起,PHP添加了clone关键字,它与clone()Matrix中定义的函数冲突.PHP.

你需要更新Matrix.php - 用"clone2"搜索和替换"clone"应该这样做.