user478636
user478636

Reputation: 3424

unexpected T_DOUBLE_ARROW when referring to an Array

I think its because I am not referring to the array properly. I'm new to PHP so I faced this error.

On this line $this->fields['id'] => &$doc->id;

Code is given for reference:

<?php 

class Zoho{
    public $fields;

    public function __construct(){
    $this->fields = array(

    //  'content' => "@/wamp/apps/researchportal/tmp/a.doc",
        'apikey' => $this->api_key,
        'output' => $this->output,
    //  'id' => time(),
    //  'filename' => $usr_bin.'_!@#$%^&^%$#@'.$usr_doc,
    //  'format' => $ext,
        'saveurl' => $this->save_url = $save_url,
        'mode' => $this->mode
    );

  }

    public function viewDocument(&$doc) {

    $this->fields['id'] => &$doc->id;
    $this->fields['filename'] => &$doc->doc_name;
    $this->fields['format'] => &$doc->doc_ext;
    $this->fields['mode']='view';
    $this->fields['content']='@'.&$doc->path;

    }


}

    $document = new Document('C:/wamp/apps/researchportal/tmp/qubee.doc');
    $zoho_s = new Zoho('http://133.223.121.12/researchportal/common/save.php');
    $zoho->viewDocument();

?>

Upvotes: 0

Views: 74

Answers (1)

Book Of Zeus
Book Of Zeus

Reputation: 49887

 public function viewDocument(&$doc) {

    $this->fields['id'] => &$doc->id;
    $this->fields['filename'] => &$doc->doc_name;
    $this->fields['format'] => &$doc->doc_ext;
    $this->fields['content'] = '@'.&$doc->path;

should be:

 public function viewDocument(&$doc) {

    $this->fields['id'] = $doc->id;
    $this->fields['filename'] = $doc->doc_name;
    $this->fields['format'] = $doc->doc_ext;
    $this->fields['content'] = '@' . $doc->path;

Upvotes: 8

Related Questions