The function you are looking for is get_object_vars:
$vars = get_object_vars($input);
foreach ($vars as $outputname => $outputval) {
}
(foreach ($object as $key => $value)), . (stdClass ), ( Traversable...
Edit
... (__get __set, protected private), :
$newoutput = clone $input;
$vars = get_object_vars($input);
foreach ($vars as $outputname => $outputval) {
$newoutput->$outputname = htmlspecialchars(stripslashes($outputval));
}
- , 100% ... - (stdClass) :
$newoutput = new StdClass();
$vars = get_object_vars($input);
foreach ($vars as $outputname => $outputval) {
$newoutput->$outputname = htmlspecialchars(stripslashes($outputval));
}