title: Creating Object instance from Posted data - PHP
body: <p>What is the best way of creating and populating an Object from values passed in from a form?</p>
  
  <p>If for example, i have a class Car with properties Colour, Model, Make, Year and a method Save, which will either insert or update the record.</p>
  
  <p>I then have a form that has fields for all these values and it is submitted. I want to create an instance of class Car with the posted values and then call the Save method. All good and well.</p>
  
  <p>But what is the best way of assigning the posted values to the objects internal properties. Assuming this is a simplified scenario and the actual situation would have many more properties, making individual Set calls long-winded.</p>
  
  <p>Is it best to simply call the Set method for each one? Or pass in an array to a method (or the constructor) which then calls the Set methods? Or some other way?</p>
  
  <p>Any advice on best practices is appreciated</p>
  
  <p>Cheers
  Stuart</p>