title: How to return JSON data from php MongoCursor
body: <p>I am using PHP to connect with MongoDB. My code is as follows.</p>
  
  <pre><code>// connect
  $m = new MongoClient($con_string); // connect to a remote host at a given port
  $db = $m-&gt;main;
  
  $customers = $db-&gt;customer-&gt;find();
  </code></pre>
  
  <p>i want to return $customers collection as json document to my HTML. How can i do this?</p>