title: How to convert an empty array and empty object to an empty string or null
body: <p>How can I convert an <strong>empty array</strong> to an <strong>empty string</strong> or <code>null</code>?</p>
  
  <pre><code>$empty_array = array();
  
  var_dump($empty_array);
  </code></pre>
  
  <p>result,</p>
  
  <pre><code>array(0) { }
  </code></pre>
  
  <p>Also for an empty object below,</p>
  
  <pre><code>class null_object{};
  $null_object = new null_object();
  var_dump($null_object);
  </code></pre>
  
  <p>result,</p>
  
  <pre><code>object(null_object)#4 (0) { }
  </code></pre>
  
  <p>I am after <code>null</code> or just something like <code>$empty_array = '';</code> whenever they are found empty.</p>