title: Why the variable containing reference to an object can't be echoed in PHP? Why the output of object and reference is same after var_dump()?
body: <p>I've a following code snippet written in a file titled "prog_1.php":</p>
  
  <pre><code>&lt;?php
    ini_set('display_startup_errors',1);
    ini_set('display_errors',1);
    error_reporting(-1);
  
    class SimpleClass {
      // property declaration
      public $var = 'a default value';
  
      // method declaration
      public function displayVar() {
        echo $this-&gt;var;
      }
    }
  
    $instance = new SimpleClass();
  
    $assigned   =  $instance;
    $reference  =&amp; $instance;
    var_dump($instance);
    echo "\n";
    echo $reference; //At this step I'm getting a "Catchable fatal error" 
    echo "\n";
    var_dump($reference); 
  ?&gt;
  </code></pre>
  
  <p>My first issue is with the below line from above code :</p>
  
  <pre><code>echo $reference;
  </code></pre>
  
  <p>For this code line I'm getting following error :</p>
  
  <pre><code>**Catchable fatal error:** Object of class SimpleClass could not be converted to string in /var/www/practice/prog_1.php on line 23
  </code></pre>
  
  <p>I'm not understanding if I could <code>var_dump()</code> the object of a class then why can't I echo the same?</p>
  
  <p>My second doubt is if execute following two statements :</p>
  
  <pre><code>var_dump($instance);
  var_dump($reference);
  </code></pre>
  
  <p>Both the statements given me the same output as follows :</p>
  
  <pre><code>object(SimpleClass)#1 (1) {
    ["var"]=&gt;
    string(15) "a default value"
  }
  </code></pre>
  
  <p>Why so? Isn't there any difference between object and reference? What does this <code>#1</code> mean in above output?</p>
  
  <p>Hope someone could clear my above doubts by providing me satisfactory and best in class answers in a simple, easy to understand and crispy language.</p>
  
  <p>Thanks in advance.</p>