I am currently using rtrim() to remove trailing newlines from strings. Is there a more efficient way to run the following commands?
$a = rtrim($a);
$b = rtrim($b);
...
$z = rtrim($z);
(Note, $a .. $z are just placeholders, they're not the real variable names)
These variables are being created through the following function
foreach ($xml->xpath('//hardware') as $hwprofile) {
$machine .= $hwprofile->machine . "\n";
$count .= $hwprofile->ProcessorInfo->count . "\n";
$speed .= $hwprofile->ProcessorInfo->speed . "\n";
$type .= $hwprofile->ProcessorInfo->type . "\n";
$arch .= $hwprofile->ProcessorInfo->architecture . "\n";
}
I want to trim those variables because they all have trailing newlines
$a,$b, etc. coming from, and what are you doing with them? I think this will influence how they could be handled more efficiently.