title: How to convert output of var_dump to array or variable?
body: <p>I am trying to take difference of two time. I have used diff function for that and now I want to transfer output of var_dump to array or variable so that I am able to print remaining time. My code is written below. <strong>How to retrieve below output to array or variable?</strong></p>
  
  <pre><code>$val1 = '2014-03-18 10:34:09';
  
  $var2 = date("Y-m-d H:i:s");
  
  $datetime1 = new DateTime($val1);
  
  $datetime2 = new DateTime($val2);
  
  var_dump($datetime1-&gt;diff($datetime2));
  </code></pre>
  
  <p><strong>My output is show below</strong></p>
  
  <pre><code>object(DateInterval)#3 (8) {
  
    ["y"]=&gt;
    int(0)
  
    ["m"]=&gt;
    int(11)
  
    ["d"]=&gt;
    int(1)
  
    ["h"]=&gt;
    int(6)
  
    ["i"]=&gt;
    int(17)
  
    ["s"]=&gt;
    int(23)
  
    ["invert"]=&gt;
    int(0)
  
    ["days"]=&gt;
    int(338)
  
  }
  </code></pre>