title: Creating Array of data in laravel controller
body: <pre><code>$document = new Document();
  $document-&gt;title = $request['title'];
  $document-&gt;description = $request['description'];
  </code></pre>
  
  <p>When i try to output the above code using <code>echo $document;</code> i get this result:</p>
  
  <pre><code>{"title":"asdfasdf","description":"asdfasdfsadf"}
  </code></pre>
  
  <p>What i want is to create my own array of data and output the same format. This is the code i am trying to experiment but it does not work:</p>
  
  <pre><code>    $data = array(
        "title" =&gt; "hello",
        "description" =&gt; "test test test"
      );
  
      echo $data;
  </code></pre>
  
  <p>Any Help would be appreciated. Thanks.</p>