title: convert print_r array of objects string to json in php
body: <p>One of my team member has saved the object in Mysql database. I need to extract the object properties values. When I am trying to fetch it from Mysql using PHP, I am getting this as string. And no luck of accessing the property directly except an idea of using PHP <code>substr()</code> function.</p>
  
  <p>Is there any option to convert the below string saved in database to object again so that I can access the property of it.</p>
  
  <pre><code>stdClass Object
  (
  [status] =&gt; 0
  [environment] =&gt; Sandbox
  [receipt] =&gt; stdClass Object
      (
          [quantity] =&gt; 1
          [expires_date] =&gt; 2017-04-18 08:56:57 Etc/GMT
          [is_trial_period] =&gt; false
          [purchase_date] =&gt; 2017-04-18 08:51:57 Etc/GMT
          [product_id] =&gt; com.1monthAuto.baseball
          [original_purchase_date_pst] =&gt; 2017-04-18 01:51:58 America/Los_Angeles
          [original_purchase_date_ms] =&gt; 1492505518000
          [web_order_line_item_id] =&gt; 1000000034854560
          [original_purchase_date] =&gt; 2017-04-18 08:51:58 Etc/GMT
      )
  
  [latest_receipt] =&gt; MIIT6wYJKoZIhvcNAQcCoIIT3DCCE9gC
  )
  </code></pre>