You're right, reviewing my code, it replaced my & amp; with & above. I was changing from the html coded amp to the string amp. So the line should I think be (without the space after &)
`$desc = str_ireplace("& amp;","&",$desc);`
Yes, I wondered where the $length variable came from. What you wrote makes more sense. I was confused because a search of my template-functions file yields only one location of $length (in that line) so I'm still uncertain how it is supposed to get that value. Did you forget the $elipsis='...' parameter in your modified declaration?
... also just notice now that the $replaceThese is displaying wrong. It changed every break to the same thing when it should be three different versions. I think the "code" functionality on this forum needs some work

But I guess that is likely by design to clean up the code.
$replaceThese = array("<b r />","<b r/>","<b r>");