The following code:
${'profile->'.$d}
Should be changed to:
$profile->{$d};
This will create the variables as expected:
$profile = new stdClass();
$profile->profileurl = "test profileurl";
$profile->websiteurl = "test websiteurl";
$data = array('profileurl', 'websiteurl');
foreach ($data as $d) {
${$d} = $profile->{$d};
}
var_dump($profileurl, $websiteurl);
// string(15) "test profileurl"
// string(15) "test websiteurl"