title: PHP Object question
body: <p>Using a very simple set of objects for this example in PHP.  </p>
  
  <p>Lets say:</p>
  
  <p><strong>ObjectA:</strong></p>
  
  <p><em>Properties:</em> DescId;</p>
  
  <p><em>Methods</em>: getListofData();</p>
  
  <p><strong>ObjectB:</strong></p>
  
  <p><em>Properties:</em> DescId;DescName;</p>
  
  <p><em>Methods:</em> getDescNameById();</p>
  
  <p>What I want to know is what is the best way to get the DescName from ObjectB when ObjectA is the one calling the function from within a loop.  </p>
  
  <p>I'm thinking that I need to instantiate ObjectB (as New) and then pass in the ObjectA.DescId into the ObjectB.getDescNameById method.  </p>
  
  <p>For example:</p>
  
  <pre><code>class objectA {
  
        function getListOfData(){
              $myObjB= new objectB();
                  while ... 
                  {
                      $myObjB-&gt;descId = $row["descId"];
                      $myDescName = $myObjB-&gt;getDescNameById();
                       ...
                       $i++;
                  }
        }
  }
  </code></pre>
  
  <p>I'm pretty sure the above will work but I'm not sure if it is the right way, or even if there are other ways of doing this.  Is there a name for this type of thing?  Some one mentioned Lazy Loading.  Is that what this is in PHP?</p>