<?php
function
getStatus (device) {
if ($device.status != 0) { return 'On';
}
else { return 'Off'; }
}
?>
…
<p>Printer:
<?php print getStatus($printer);
?></p>
<p>Stacker:
<?php print getStatus($stacker);
?></p>
<p>Stapler
options: <?php print getStatus($soptions);
?></p>
http://www.w3.org/International/articles/text-reuse/