I'm making a class and I want to be able to automatically assign variables being posted from an ajax request.
function assign_vars() {
foreach($_POST as $index => $value) {
if($index == 'car_year') {
$this->car_year = $value;
}
}
}
This function would be very handy is their a cleaner way of doing this.