Well, there are probably a gajillion ways to skin this cat. Part of the fun would be seeing several of them (and possibly deciding which is best ... which is what we've spent lots of bytes on in the past, lol).
Here's a quick take I did in the CLI. Probably not optimal at all, but you get an idea of how you might handle it.
<?php
$n=$argv['1'];
$tens=floor($n/10);
$ones=$n%10;
echo " for $n cents, change is $tens dimes and $ones pennies\n";
?>
Of course, this doesn't use any "nickels". You could make it do so, of course.