title: Setting namespace for stdClass object in PHP
body: <p>Would anyone happen to know if it's possible to set a namespace on a user-defined stdClass object.</p>
  
  <p>What I would like to do is to return all the private properties of a class as an object in the form of a getter method.</p>
  
  <p>I found one possible solution where I could do something like this;</p>
  
  <pre><code>public function getDataItems() {
    $dataObj = new stdClass;
    $dataObj-&gt;image_id   = $this-&gt;image_id;
    $dataObj-&gt;image_name = $this-&gt;image_name;
    $dataObj-&gt;name       = $this-&gt;name;
    $dataObj-&gt;email      = $this-&gt;email;
    $dataObj-&gt;company    = $this-&gt;company;
  
    return $dataObj;
  }
  </code></pre>
  
  <p>The only problem I have though is that the class that this function lives in is using a namespace and therefore I need to somehow assign the same namespace to this $dataObj object.</p>
  
  <p>Does anyone know how I can do this or if it's even possible?</p>