PHP - nl2br type function for symbols?

Is there a php function similar to nl2br, only it replaces symbols with their correct codes (& = &).

Thanks
Brendan