<?php $customer = new stdClass(); $customer->{"first-name"} = "NAME"; $customer->{"last-name"} = "NAME"; $customer->{"phone-numer"} = "NUMBER"; print_r($customer); foreach (get_object_vars($customer) as $key => $value) { $key2 = str_replace('-', '_', $key); $customer->$key2 = $customer->$key; unset($customer->$key); } print_r($customer);
You have javascript disabled. You will not be able to edit any code.